Пример #1
0
        private async Task Populate()
        {
            IsLoadedData = false;

            if (HyperStore == null || string.IsNullOrWhiteSpace(MissionId))
            {
                return;
            }

            var documentId  = HyperDocumentId.Create <HyperMission>(MissionId);
            var argTagonomy = new RetrieveHyperDocumentArgs(documentId);
            var doc         = await HyperStore.ExecuteAsync(argTagonomy);

            if (argTagonomy.ExecutionResult.IsNotSuccess)
            {
                return;
            }

            var data = doc?.GetPayload <HyperMission>();

            Source = new MissionItemVm(data, HyperStore);
            await Source.UpdateStatus();

            Source.OnToastMessage = OnToastMessage;

            SelectedPhase = Source.Mission?.Phases.FirstOrDefault();

            IsLoadedData = true;
        }
Пример #2
0
        public async Task LoadHyperTags()
        {
            if (this.HyperStore == null)
            {
                return;
            }

            TagsAreBeingLoaded = true;

            var findArgs = new FindHyperDocumentsArgs(typeof(HyperTag));

            var conditions = await MetaDataSetHelper.GenerateFilterFromMetaDataSetAsync(HyperStore, _metadataSet);

            findArgs.DescriptorConditions.AddCondition(conditions.Result);
            findArgs.Skip  = PageSize * (PageNumber - 1);
            findArgs.Limit = PageSize;

            var docs = await HyperStore.ExecuteAsync(findArgs);

            var hyperTags = new List <HyperTag>();

            foreach (var doc in docs)
            {
                hyperTags.Add(doc.GetPayload <HyperTag>());
            }

            HyperTags.Value = hyperTags;

            TagsAreBeingLoaded = false;

            RaiseNotify(nameof(HyperTags));
        }
Пример #3
0
        private async Task Populate()
        {
            Items.Clear();
            IsLoadedData = false;


            var findArgs = new FindHyperDocumentsArgs();

            findArgs.SetDocumentType(typeof(Tagonomy));

            if (string.IsNullOrWhiteSpace(Search) == false)
            {
                Guid parsedGuid;
                if (Guid.TryParse(Search, out parsedGuid))
                {
                    findArgs.DocumentConditions.AddCondition("_id", Search);
                }
                else
                {
                    var condition = new MultiScopeCondition();

                    var conditionOr = new MultiScopeCondition()
                    {
                        Mode = AndOr.Or
                    };
                    var regex = $"/{Search}/ig";
                    conditionOr.AddCondition(nameof(Tagonomy.Name), regex, Comparers.Regex);
                    //conditionOr.AddCondition(nameof(Tagonomy.Id), regex, ScopeCondition.Comparators.Regex);
                    conditionOr.AddCondition(nameof(Tagonomy.Group), regex, Comparers.Regex);
                    condition.AddCondition(conditionOr);

                    findArgs.DescriptorConditions.AddCondition(condition);
                }
            }

            var tagonomies = await HyperStore.ExecuteAsync(findArgs);

            if (tagonomies == null || !tagonomies.Any())
            {
                IsLoadedData = true;
                return;
            }

            foreach (var tagonomy in tagonomies)
            {
                var configuration = tagonomy.GetPayload <Tagonomy>();
                if (configuration == null)
                {
                    Console.WriteLine($"Failed to load tagonomy from document: {tagonomy.Id}");
                    continue;
                }

                Items.Add(configuration);
            }

            Items = Items.OrderBy(it => it.Group).ToList();

            IsLoadedData = true;
        }
Пример #4
0
        public async Task DeleteDashboard(DashboardData data)
        {
            var args = new DeleteHyperDocumentArgs(HyperDocumentId.Create <DashboardData>(data.Id));
            var isDeleteSuccessful = await HyperStore.ExecuteAsync(args);

            if (isDeleteSuccessful)
            {
                DataList.RemoveAll(it => it.Id == data.Id);
            }
        }
Пример #5
0
        public async Task SaveChanges()
        {
            var doc = new HyperDocument(SelectedDashboard);

            var args = new StoreHyperDocumentArgs(doc);
            var res  = await HyperStore.ExecuteAsync(args);

            IsShowRenameDashboardModal = false;

            await LoadDashboarList();
        }
Пример #6
0
        public async Task <byte[]> ExtractAllDashboards()
        {
            var dashboards = new List <DashboardData>();

            var findDocArgs = new FindHyperDocumentsArgs(typeof(DashboardData), true);
            var documents   = await HyperStore.ExecuteAsync(findDocArgs);

            if (!findDocArgs.ExecutionResult.IsNotSuccess || documents != null)
            {
                foreach (var doc in documents)
                {
                    var dashboard = doc?.GetPayload <DashboardData>();

                    if (dashboard != null)
                    {
                        dashboards.Add(dashboard);
                    }
                }
            }

            var compressedFileStream = new MemoryStream();

            using (compressedFileStream)
            {
                //compressedFileStream.Seek(0, SeekOrigin.Begin);
                using (var zipArchive = new ZipArchive(compressedFileStream, ZipArchiveMode.Create, false))
                {
                    foreach (var data in dashboards)
                    {
                        var projectJson = JsonHelper.Serialize(data);
                        var fileName    = $"{data?.Name}.json";

                        //Create a zip entry for each attachment
                        var zipEntry = zipArchive.CreateEntry(fileName);

                        //Get the stream of the attachment
                        using (var originalFileStream = new MemoryStream(Encoding.UTF8.GetBytes(projectJson)))
                        {
                            using (var zipEntryStream = zipEntry.Open())
                            {
                                //Copy the attachment stream to the zip entry stream
                                originalFileStream.CopyTo(zipEntryStream);
                            }
                        }
                    }
                }
            }
            var result = compressedFileStream.ToArray();

            return(result);
        }
Пример #7
0
        public async Task <DashboardData> GetDashboard(string dashboardId)
        {
            var documentId = HyperDocumentId.Create <DashboardData>(dashboardId);
            var args       = new RetrieveHyperDocumentArgs(documentId);
            var doc        = await HyperStore.ExecuteAsync(args);

            if (args.ExecutionResult.IsNotSuccess)
            {
                return(null);
            }

            var dashboard = doc?.GetPayload <DashboardData>();

            return(dashboard);
        }
Пример #8
0
        public async Task <List <FlowDesignNodeStatus> > LoadWorkflowStatuses()
        {
            var result = new List <FlowDesignNodeStatus>();

            if (HyperStore == null || string.IsNullOrWhiteSpace(WorkflowId) || string.IsNullOrWhiteSpace(WorkflowInstanceId))
            {
                return(result);
            }

            var args = new RetrieveHyperWorkflowsStatusesArgs();

            var statsArgs = new RetrieveHyperWorkflowsStatusesArgs
            {
                WorkflowConfigurationIds = new string[] { WorkflowId },
                WorkflowInstancesIds     = new string[] { WorkflowInstanceId }
            };

            var statuses = await HyperStore.ExecuteAsync(statsArgs);

            if (statuses != null && statuses.Any())
            {
                var workflowStatuses = statuses.OrderBy(it => it.PrintTitle).ToList();
                foreach (var wfStatus in workflowStatuses)
                {
                    foreach (var status in wfStatus.NodeStatuses)
                    {
                        var state = status.OperationalState == Common.UniOperationalStates.Operational ? "OK" : status.OperationalState.ToString();

                        var designNodeStatus = new FlowDesignNodeStatus()
                        {
                            NodeId               = status.NodeId,
                            StatusMessage        = status.StatusMessage,
                            SystemStatusMessage  = status.SystemStatusMessage,
                            DefaultStatusMessage = status.GenerateDefaultStatusMessage(),
                            LoggerStatusMessage  = status.GenerateLoggerStatusMessage(),
                            IsActive             = status.IsActive,
                            State = state
                        };

                        result.Add(designNodeStatus);
                    }
                }
            }

            return(result);
        }
Пример #9
0
        private async Task PopulateData()
        {
            if (HyperStore == null || string.IsNullOrWhiteSpace(WorkflowId))
            {
                return;
            }

            var documentId = HyperDocumentId.Create <HyperWorkflow>(WorkflowId);
            var args       = new RetrieveHyperDocumentArgs(documentId);
            var doc        = await HyperStore.ExecuteAsync(args);

            if (args.ExecutionResult.IsNotSuccess)
            {
                return;
            }

            Source = doc?.GetPayload <HyperWorkflow>();
        }
Пример #10
0
        private async Task PopulateWorkflows()
        {
            Items.Clear();
            IsLoadedData = false;

            var findArgs = new FindHyperDocumentsArgs();

            findArgs.SetDocumentType(typeof(HyperWorkflow));
            var workflows = await HyperStore.ExecuteAsync(findArgs);

            if (workflows == null || !workflows.Any())
            {
                return;
            }

            var statsArgs = new RetrieveHyperWorkflowsStatusesArgs();
            var statuses  = await HyperStore.ExecuteAsync(statsArgs);

            if (statuses == null)
            {
                statuses = new HyperWorkflowStatus[] { };
            }

            foreach (var workflow in workflows)
            {
                var configuration = workflow.GetPayload <HyperWorkflow>();
                if (configuration == null)
                {
                    Console.WriteLine($"Failed to load workflow from document: {workflow.Id}");
                    continue;
                }

                var wfVm = new WorkflowConfigurationVm
                {
                    Source           = configuration,
                    WorkflowStatuses = statuses.Where(it => it.Configuration.Id == configuration.Id).ToArray()
                };

                Items.Add(wfVm);
            }

            IsLoadedData = true;
        }
        private async Task UpdateMissionCollections()
        {
            Missions.Clear();
            var workflowStatuses = new List <HyperWorkflowStatus>();

            foreach (var node in _nodes)
            {
                var retrieveWorkflowsArgs = new RetrieveHyperWorkflowsStatusesArgs();
                var statuses = await HyperStore.ExecuteAsync(retrieveWorkflowsArgs);

                var missions = new List <HyperWorkflowStatus>();
                if (statuses != null)
                {
                    foreach (var status in statuses)
                    {
                        var isMaster = status.SlaveWorkflowStatuses != null && status.SlaveWorkflowStatuses.Any();
                        var isSlave  = status.ParentWorkflowInstanceId != null;

                        if (!isMaster && !isSlave)
                        {
                            var hasTasks = status.ActiveTaskPhases != null && status.ActiveTaskPhases.Length > 0 &&
                                           status.ActiveTaskPhases.Sum(x => x.PendingTasksCount) > 0;
                            if (hasTasks)
                            {
                                missions.Add(status);
                            }
                        }
                        else if (isSlave)
                        {
                            if (!status.IsCompleted)
                            {
                                missions.Add(status);
                            }
                        }
                    }
                }

                missions = missions.Where(m => !string.IsNullOrEmpty(m.MissionId)).ToList();

                missions.ForEach(m => Missions.Add(m));
            }
        }
        public async Task <DashboardData> GetDashboardAsync()
        {
            if (string.IsNullOrWhiteSpace(this.Widget.Dashboard?.Id))
            {
                return(null);
            }

            var documentId = HyperDocumentId.Create <DashboardData>(this.Widget.Dashboard?.Id);
            var args       = new RetrieveHyperDocumentArgs(documentId);
            var doc        = await HyperStore.ExecuteAsync(args);

            if (args.ExecutionResult.IsNotSuccess)
            {
                return(null);
            }

            var dashboard = doc?.GetPayload <DashboardData>();

            return(dashboard);
        }
Пример #13
0
        private async Task PopulateData()
        {
            if (HyperStore == null || string.IsNullOrWhiteSpace(TagonomyId))
            {
                return;
            }

            var documentId  = HyperDocumentId.Create <Tagonomy>(TagonomyId);
            var argTagonomy = new RetrieveHyperDocumentArgs(documentId);
            var doc         = await HyperStore.ExecuteAsync(argTagonomy);

            if (argTagonomy.ExecutionResult.IsNotSuccess)
            {
                return;
            }

            Source = doc?.GetPayload <Tagonomy>();

            RefreshNavigation();
        }
Пример #14
0
        private async Task PopulateData()
        {
            Items.Clear();
            IsLoadedData = false;

            if (HyperStore == null || string.IsNullOrWhiteSpace(WorkflowId))
            {
                return;
            }

            //var documentId = HyperDocumentId.Create<HyperWorkflow>(WorkflowId);
            //var wfArgs = new RetrieveHyperDocumentArgs(documentId);
            //var wfDoc = await HyperStore.ExecuteAsync(wfArgs);

            //if (wfArgs.ExecutionResult.IsNotSuccess)
            //	return;

            //var workflow = wfDoc?.GetPayload<HyperWorkflow>();


            var statsArgs = new RetrieveHyperWorkflowsStatusesArgs {
                WorkflowConfigurationIds = new string[] { WorkflowId }
            };
            //var statsArgs = new RetrieveHyperWorkflowsStatusesArgs();
            var statuses = await HyperStore.ExecuteAsync(statsArgs);

            if (statuses != null && statuses.Any())
            {
                var workflowStatuses = statuses.OrderBy(it => it.PrintTitle).ToList();
                foreach (var st in workflowStatuses)
                {
                    var wfInstVm = new WorkflowInstanceVm()
                    {
                        Source = st, HyperStore = HyperStore
                    };
                    Items.Add(wfInstVm);
                }
            }

            IsLoadedData = true;
        }
        private async Task PopulateData()
        {
            if (HyperStore == null || string.IsNullOrWhiteSpace(TagonomyId))
            {
                return;
            }

            var documentId  = HyperDocumentId.Create <Tagonomy>(TagonomyId);
            var argTagonomy = new RetrieveHyperDocumentArgs(documentId);
            var doc         = await HyperStore.ExecuteAsync(argTagonomy);

            if (argTagonomy.ExecutionResult.IsNotSuccess)
            {
                return;
            }

            _rootTagonomy = doc?.GetPayload <Tagonomy>();

            _unprocessedSourceTagonomies.Clear();
            _processedSourceTagonomies.Clear();


            var args = new FindHyperDocumentsArgs(typeof(Tagonomy), true);

            _allTagonomies = ((await this.HyperStore.ExecuteAsyncThrows(args)) ?? new Node.Common.HyperDocument[0])
                             .Select(x => x.GetPayload <Tagonomy>())
                             .ToArray();

            _unprocessedSourceTagonomies.Add(_rootTagonomy.Id, _rootTagonomy);

            while (_unprocessedSourceTagonomies.Any())
            {
                foreach (var unprocTagonomie in _unprocessedSourceTagonomies.Select(x => x.Value).ToArray())
                {
                    var linkingNodesInner = GetLinkingNodes(unprocTagonomie);
                    ProcessLinkingNodes(linkingNodesInner, unprocTagonomie, true);
                }
            }

            GoBackwards();
        }
Пример #16
0
        protected async Task DoRefreshAsync()
        {
            if (HyperStore == null || this.Source == null || string.IsNullOrEmpty(this.Source.WorkflowInstanceId))
            {
                return;
            }

            this.Source.NodeStatuses = new HyperWorkflowNodeStatus[] { };             // Clear all the statuses.

            var args = new RetrieveHyperWorkflowsStatusesArgs()
            {
                WorkflowInstancesIds = new string[] { this.Source.WorkflowInstanceId }
            };

            HyperWorkflowStatus[] statuses = await HyperStore.ExecuteAsync(args);

            if (statuses != null && statuses.Length > 0)
            {
                Source = statuses.FirstOrDefault(it => it.WorkflowInstanceId == WorkflowInstanceId);
            }
        }
Пример #17
0
        private async Task <int> GetDashApiPort()
        {
            var streamingPort             = 8585;
            var retrieveConfigurationArgs = new RetrieveConfigurationArgs();

            var result = await HyperStore.ExecuteAsync(retrieveConfigurationArgs);

            foreach (var item in result)
            {
                if (item.ComponentConfigType == typeof(StandardsBasedNetStoreServerConfig))
                {
                    var config = new StandardsBasedNetStoreServerConfig();
                    JsonHelper.Populate(item.Json, config);
                    if (config.HttpsPort.HasValue)
                    {
                        streamingPort = config.HttpsPort.Value;
                    }
                }
            }

            return(streamingPort);
        }
Пример #18
0
        public async Task LoadDashboarList()
        {
            DataList.Clear();
            IsLoadedDataResult = false;

            if (string.IsNullOrWhiteSpace(SearchInput))
            {
                // We are only going to pull the basic info on the Dashboards, as they are becoming large objects.
                var datas = await HyperStore.FindAllAsync <DashboardData>(null, 0, 500, true);

                DataList = datas.ToList();
            }
            else
            {
                var findDocArgs = new FindHyperDocumentsArgs(typeof(DashboardData), true);

                var regexText = $"/.*{SearchInput}.*/i";

                var conditions = new MultiScopeCondition(AndOr.Or);
                conditions.AddCondition(nameof(DashboardData.Name), regexText, Comparers.Regex);
                conditions.AddCondition(nameof(DashboardData.Group), regexText, Comparers.Regex);
                conditions.AddCondition(nameof(DashboardData.Tag), regexText, Comparers.Regex);

                findDocArgs.DescriptorConditions = conditions;

                var documents = await HyperStore.ExecuteAsync(findDocArgs);

                DataList = documents.Select(x => x.GetPayload <DashboardData>()).ToList();

                if (!findDocArgs.ExecutionResult.IsNotSuccess || documents != null)
                {
                    DataList = documents.Select(x => x.GetPayload <DashboardData>()).ToList();
                }
            }

            IsLoadedDataResult = true;

            this.RaiseNotify(nameof(DataList));
        }
Пример #19
0
        private async Task Populate()
        {
            Items.Clear();
            IsLoadedData = false;

            var findArgs = new FindHyperDocumentsArgs();

            findArgs.SetDocumentType(typeof(HyperMission));
            findArgs.DescriptorConditions.Mode = AndOr.Or;
            findArgs.DescriptorConditions.AddCondition(Assist.GetPropertyName((HyperMission i) => i.Archived), false);
            findArgs.DescriptorConditions.AddCondition(Assist.GetPropertyName((HyperMission i) => i.Archived), false, Comparers.DoesNotExist);
            var docs = await HyperStore.ExecuteAsync(findArgs);

            if (docs == null || !docs.Any())
            {
                return;
            }

            foreach (var doc in docs)
            {
                var data = doc.GetPayload <HyperMission>();
                if (data == null)
                {
                    await OnToastMessage.InvokeAsync(new ToastMessage($"Failed to load data from document: {data.Id}", ToastMessageType.Error));

                    continue;
                }

                var model = new MissionItemVm(data, HyperStore);
                await model.UpdateStatus();

                model.OnToastMessage = OnToastMessage;

                Items.Add(model);
            }

            IsLoadedData = true;
        }
Пример #20
0
        private async Task UpdateModelStatusAsync()
        {
            string missionId = Mission.Id;

            if (HyperStore == null || missionId == null || _callPending)
            {
                return;
            }

            var args = new GetHyperMissionStatusArgs()
            {
                MissionId = missionId
            };

            _callPending = true;
            try
            {
                InstanceStatus = await HyperStore.ExecuteAsync(args);
            }
            finally
            {
                _callPending = false;
            }
        }
Пример #21
0
        private async Task InitializeMetadatasetEdgeDates()
        {
            FilterState.Value.HeatMapMinDate.Value = this.FilterState.Value.MetadataSetMinDate;
            FilterState.Value.HeatMapMaxDate.Value = this.FilterState.Value.MetadataSetMaxDate;

            if (_metadataSet != null)
            {
                var findArgs   = new FindHyperDocumentsArgs(typeof(HyperTag));
                var conditions = await MetaDataSetHelper.GenerateFilterFromMetaDataSetAsync(HyperStore, _metadataSet);

                findArgs.DescriptorConditions.AddCondition(conditions.Result);

                findArgs.Limit         = 1;
                findArgs.OrderByFields = new OrderByField[]
                {
                    new OrderByField()
                    {
                        Ascending       = true,
                        DescriptorField = true,
                        FieldName       = "Elements.UniversalTime"
                    }
                };

                var results = await HyperStore.ExecuteAsync(findArgs);

                if (results?.Length > 0 == false)
                {
                    return;
                }

                var earliestTag  = results[0].GetPayload <HyperTag>();
                var earliestDate = earliestTag.GetUniversalDateTimeFromElements();

                var lastTagFindArgs = new FindHyperDocumentsArgs(typeof(HyperTag));
                lastTagFindArgs.DescriptorConditions.AddCondition(conditions.Result);
                lastTagFindArgs.OrderByFields = new OrderByField[]
                {
                    new OrderByField()
                    {
                        Ascending       = false,
                        DescriptorField = true,
                        FieldName       = "Elements.UniversalTime"
                    }
                };
                lastTagFindArgs.Limit = 1;
                var latestTag  = (await HyperStore.ExecuteAsync(lastTagFindArgs))[0].GetPayload <HyperTag>();
                var latestDate = latestTag.GetUniversalDateTimeFromElements();

                this.FilterState.Value.MetadataSetMinDate.Value = earliestDate.Value;
                if (this.FilterState.Value.FilterMinDate.Value == null)
                {
                    this.FilterState.Value.HeatMapMinDate.Value = earliestDate.Value;
                }
                this.FilterState.Value.MetadataSetMaxDate.Value = latestDate.Value;
                if (FilterState.Value.FilterMaxDate.Value == null)
                {
                    this.FilterState.Value.HeatMapMaxDate.Value = latestDate.Value;
                }

                this.OnMetadatasetEdgeDatesUpdated?.Invoke(earliestDate.Value, latestDate.Value);
            }
        }