+ @{
+ // TODO: REFACTORING!
+
+ // ideas:
+ // - get rid of spans -> better: use inline divs with tailwind classes instead of style paramters
+ // - use tailwind grid
+ // - making private methods and/or components
+
+ // Displaying node type and node name
+
+ @ViewNodeType(selectedNode)
+ @ViewNodeID(selectedNode)
+
+
+ for (int line = 0; line < 6; line++)
+ {
+ string nodeType = ViewNodeDetails(selectedNode, line, 0);
+ string nodeValue = ViewNodeDetails(selectedNode, line, 1);
+ string additionalInformationOfNode = ViewNodeDetails(selectedNode, line, 2);
+
+ if (nodeType != string.Empty && nodeValue != string.Empty)
+ {
+
+ @nodeType
+ @nodeValue @additionalInformationOfNode"
+
+ }
+ }
+
+
+ if (selectedNode != null && selectedNode.Tag is Referable r)
+ {
+
UPDATE @r.TimeStamp.ToString("yy-MM-dd HH:mm:ss.fff")
+
+
+
+
+
+
CREATE @r.TimeStampCreate.ToString("yy-MM-dd HH:mm:ss.fff")
+
+
+ @code {
+ private void setTimeStamp()
+ {
+ (selectedNode.Tag as Referable).setTimeStamp(DateTime.UtcNow);
+ }
+ }
+ }
+ // if (selectedNode != null && hasDownloadFile(selectedNode))
+ // {
+ //
+ //
+ // }
+ bool externalLink = false;
+ string link = getLink(selectedNode, out externalLink);
+ if (selectedNode != null && link != "")
+ {
+ // if (externalLink)
+ if (true)
+ {
+
@link
+
+
+ }
+ else
+ {
+
+
+
+ }
+ if (selectedNode != null && selectedNode.Tag is Submodel && Program.connectServer != "")
+ {
+ bool toPublish = Program.submodelsToPublish.Contains(selectedNode.Tag);
+ bool toSubscribe = Program.submodelsToSubscribe.Contains(selectedNode.Tag);
+ if (toPublish)
+ {
+
+ }
+ else
+ {
+
+ }
+ if (toSubscribe)
+ {
+
+ }
+ else
+ {
+
+ }
+ //
+ @code {
+ private void resetSubmodelToPublish()
+ {
+ Program.submodelsToPublish.Remove(selectedNode.Tag);
+ }
+ private void setSubmodelToPublish()
+ {
+ bool toSubscribe = Program.submodelsToSubscribe.Contains(selectedNode.Tag);
+ if (!toSubscribe)
+ Program.submodelsToPublish.Add(selectedNode.Tag);
+ }
+ private void resetSubmodelToSubscribe()
+ {
+ Program.submodelsToSubscribe.Remove(selectedNode.Tag);
+ }
+ private void setSubmodelToSubscribe()
+ {
+ bool toPublish = Program.submodelsToPublish.Contains(selectedNode.Tag);
+ if (!toPublish)
+ Program.submodelsToSubscribe.Add(selectedNode.Tag);
+ }
+ }
+ }
+ }
+ if (selectedNode != null && selectedNode.Tag is Property && Program.edit)
+ {
+ //
@CurrentValue
+
@CurrentValue
+
+
+ @code {
+ private string CurrentValue { get; set; }
+ }
+ if (CurrentValue != null && CurrentValue != "")
+ {
+ if (selectedNode.Tag is Property)
+ {
+ (selectedNode.Tag as Property).value = CurrentValue;
+ (selectedNode.Tag as Property).setTimeStamp(DateTime.UtcNow);
+ this.StateHasChanged();
+ }
+ CurrentValue = "";
+ }
+ }
+ if (selectedNode != null && (selectedNode.Tag is AdministrationShell || selectedNode.Tag is AdminShellNS.AdminShellV20.File))
+ {
+ if (selectedNode.Tag is AdministrationShell)
+ {
+
+
+
+ string qrcodeLink = getQRCodeLink(selectedNode);
+ if (Program.generatedQrCodes.ContainsKey(selectedNode.Tag))
+ {
+ string qrcodeImage = getQRCodeImage(selectedNode);
+ if (qrcodeImage != "")
+ {
+
+
+
+
+
+ }
+ }
+ else
+ {
+
@qrcodeLink
+
+
+ }
+ @code {
+ private void runCreateQRCodeImage()
+ {
+ createQRCodeImage(selectedNode);
+ }
+ }
+ }
+ }
+
+ if (selectedNode != null && selectedNode.Tag is SubmodelElementCollection smc)
+ {
+ string semanticId = "";
+ // bool render = false;
+
+ try
+ {
+ semanticId = smc.semanticId.Keys[0].value;
+ }
+ catch { }
+ if (semanticId == "https://admin-shell.io/sandbox/zvei/TimeSeriesData/TimeSeries/1/0" ||
+ semanticId == "https://admin-shell.io/sandbox/zvei/TimeSeriesData/TimeSeriesSegment/1/0")
+ {
+ TimeSpan diff = smc.TimeStamp - timeStampPlot;
+
+ if (smc != collectionPlot || diff.TotalSeconds < 0 || diff.TotalSeconds >= 5)
+ {
+ watchTimeToProcessImage = System.Diagnostics.Stopwatch.StartNew();
+
+ collectionPlot = smc;
+ timeStampPlot = smc.TimeStamp;
+
+ //ListOfTimeSeriesData _timeSeriesData = new ListOfTimeSeriesData();
+ _timeSeriesData.Clear();
+ var mm = AdminShell.Key.MatchMode.Relaxed;
+
+ // make initial data for time series
+ var tsd = new TimeSeriesData() { SourceTimeSeries = smc };
+ _timeSeriesData.Add(tsd);
+
+ // plot arguments for time series
+ tsd.Args = PlotArguments.Parse(smc.HasQualifierOfType("TimeSeries.Args")?.value);
+
+ // TODO: info - ZveiTimeSeriesDataV10 is currently hardcoded as JSON string in code
+ var pcts = ZveiTimeSeriesDataV10.Static;
+
+ var tssReference = pcts.CD_TimeSeriesSegment.GetReference();
+ //var k = new Key("ConceptDescription", false, "IRI", "https://admin-shell.io/sandbox/zvei/TimeSeriesData/TimeSeriesSegment/1/0");
+ //var tssReference = new Reference(k);
+ //var smcAllValues = smc.value.FindAllSemanticIdAs
(tssReference, mm);
+
+ // is it a segment
+ try
+ {
+ if (semanticId == "https://admin-shell.io/sandbox/zvei/TimeSeriesData/TimeSeriesSegment/1/0")
+ {
+ TimeSeriesAddSegmentData(pcts, mm, tsd, smc);
+ }
+ else
+ {
+ // search for segements on current level
+ var smcAllValues = smc.value.FindAllSemanticIdAs(tssReference, mm);
+
+ if (smcAllValues.Count() != 0)
+ {
+ foreach (var smcseg in smcAllValues)
+ {
+ TimeSeriesAddSegmentData(pcts, mm, tsd, smcseg);
+ }
+ }
+ }
+ }
+ catch
+ {
+ };
+
+ _timeSeriesData?.RenderTimeSeries(defPlotHeight: 200, "en", bi.sessionNumber, plotFilter.combinedFromDate, plotFilter.combinedToDate);
+ watchTimeToProcessImage.Stop();
+ }
+
+ byte[] imageArray;
+ string timeSeriesImageBase64 = "";
+ string scottplotImgPath = "wwwroot/images/scottplot/smc_timeseries_clientid" + bi.sessionNumber + ".png";
+
+ if (System.IO.File.Exists(scottplotImgPath))
+ {
+ imageArray = System.IO.File.ReadAllBytes(scottplotImgPath);
+ timeSeriesImageBase64 = Convert.ToBase64String(imageArray);
+ }
+
+ var elapsedMsToProcessImage = watchTimeToProcessImage.ElapsedMilliseconds;
+
+ if (System.IO.File.Exists(scottplotImgPath))
+ {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
showImageModal = !showImageModal" src=data:image;base64,@timeSeriesImageBase64 alt="Visualization of time series" style="max-width:950px;cursor:zoom-in;" />
+
+ Image processing took @elapsedMsToProcessImage ms (Last update: @timeStampPlot.ToString("yy-MM-dd HH:mm:ss.fff"))
+
+
+
+
+
+
+
+
+
showImageModal = !showImageModal" src=data:image;base64,@timeSeriesImageBase64 alt="Visualization of time series" style="max-width:90%;max-height:90%;cursor:zoom-out;" class="mb-2" />
+
+
+
+
+ }
+ else
+ {
+ Rendering time series...
+ }
+ }
+ else
+ {
+ collectionPlot = null;
+ }
+ }
+ }
+
+ @{
+ string detailsImage = createDetailsImage(selectedNode);
+ if (detailsImage != "")
+ {
+
+
+
+
+ }
+
+ if (selectedNode != null && (selectedNode.Tag is AdminShellNS.AdminShellV20.BasicEvent be))
+ {
+ if (be.observed != null)
+ {
+ string okey = be.observed.GetAsExactlyOneKey().ToString();
+ Observed
+ @(" " + okey)
+
+
+ var refsme = Program.env[0].AasEnv.FindReferableByReference(be.observed);
+ if (refsme != null)
+ {
+ UPDATE @refsme.TimeStamp.ToString("yy-MM-dd HH:mm:ss.fff")
+
+
+ CREATE @refsme.TimeStampCreate.ToString("yy-MM-dd HH:mm:ss.fff")
+
+
+ }
+ else
+ {
+ Referenced element does not exist!
+
+
+ }
+ }
+ }
+ }
+