Skip to content

Commit

Permalink
#1647 create a svelte component where taginfos are shown to a version…
Browse files Browse the repository at this point in the history
…, update on pubslih, show, release note, tag nr
  • Loading branch information
DavidBlaa committed Aug 22, 2024
1 parent 9d28044 commit 3171c06
Show file tree
Hide file tree
Showing 209 changed files with 422 additions and 2,216 deletions.
20 changes: 19 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_space_around_binary_operators = before_and_after
csharp_indent_labels = one_less_than_current
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_prefer_braces = true:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion

[*.vb]
#### Benennungsstile ####
Expand Down Expand Up @@ -134,4 +151,5 @@ dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
2 changes: 1 addition & 1 deletion BExIS++.sln
Original file line number Diff line number Diff line change
Expand Up @@ -1519,8 +1519,8 @@ Global
{44DD2A5E-0D2F-4FAB-B297-4211441030B6} = {A98E4405-1702-4F38-9EBD-AEA67D4185A6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9B6E4921-8EBA-487D-A098-3E473A0EAC64}
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35;packages\Unity.2.1.505.2\lib\NET35
SolutionGuid = {9B6E4921-8EBA-487D-A098-3E473A0EAC64}
EndGlobalSection
GlobalSection(SubversionScc) = preSolution
Svn-Managed = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ public object ImportFrom(Type returnType, object source, ITypeResolver typeResol
{
var resourceDocument = new XmlDocument();
var sw = new StringWriter();
var xw = new XmlTextWriter(sw);
((XmlNode)source).WriteTo(xw);
var temp = sw.ToString();
resourceDocument.LoadXml(temp);
using (var xw = new XmlTextWriter(sw))
{
((XmlNode)source).WriteTo(xw);
var temp = sw.ToString();
resourceDocument.LoadXml(temp);

doc = resourceDocument;
}

doc = resourceDocument;
//doc.ImportNode((XmlNode)source, true);
//doc = ((XmlNode)source).OwnerDocument;
}
if (deSerializer == null)
deSerializer = new ObjGraphXmlDeserializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
using BExIS.Modules.Dcm.UI.Helpers;
using System.Xml;
using BExIS.Dim.Entities.Mappings;
using Remotion.Linq.Parsing.Structure.NodeTypeProviders;

namespace BExIS.Modules.Dcm.UI.Controllers
{
Expand Down Expand Up @@ -165,19 +166,19 @@ public async Task<HttpResponseMessage> Put([FromBody] DataApiModel data)
pkVariables = dataStructure.Variables.Where(v => v.IsKey).ToList();

// prepare pk index list from data
int[] primaryKeyIndexes = new int[pkVariables.Count];
List<int> primaryKeyIndexes = new List<int>();
for (int i = 0; i <= dataStructure.Variables.Count - 1; i++)
{
var variable = dataStructure.Variables.ElementAt(i);
if (variable.IsKey)
{
primaryKeyIndexes[i] = data.Columns.ToList().IndexOf(variable.Label);
primaryKeyIndexes.Add(data.Columns.ToList().IndexOf(variable.Label));
}
}

//check primary with data : uniqueness
//bool IsUniqueInDb = uploadHelper.IsUnique2(dataset.Id, variables.Select(v=>v.Id).ToList()); // may can removed
bool IsUniqueInData = uploadHelper.IsUnique(primaryKeyIndexes, data.Data);
bool IsUniqueInData = uploadHelper.IsUnique(primaryKeyIndexes.ToArray<int>(), data.Data);

if (!IsUniqueInData)
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
%sveltekit.head%
</head>
<body data-theme="bexis2theme">
<div>%sveltekit.body%</div>
<div id="taginfo" dataset="1">
%sveltekit.body%
</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,19 +1,177 @@
<script>
import { Page, pageContentLayoutType } from "@bexis2/bexis2-core-ui";
import { getTagInfos } from '$services'
import { onMount } from 'svelte'
<script lang="ts">
onMount(()=>{
import { Page, pageContentLayoutType, TablePlaceholder, Table, notificationStore, notificationType, ErrorMessage} from "@bexis2/bexis2-core-ui";
import { get, save } from './services'
import { tagInfoModelStore } from './stores.js'
import TablePublish from "./table/tablePublish.svelte";
import TableShow from "./table/tableShow.svelte";
import TableNr from "./table/tableNr.svelte";
import TableText from "./table/tableText.svelte";
import TableOptions from "./table/tableOptions.svelte";
import TableDate from "./table/tableDate.svelte";
import type { TagInfoModel } from "./types";
import TableReleaseNote from "./table/tableReleaseNote.svelte";
})
let container;
let id: number = 0;
async function reload(){
container = document.getElementById('taginfo');
id = Number(container?.getAttribute('dataset'));
var taginfos = await get(id);
console.log("🚀 ~ onMount ~ taginfos:", taginfos)
tagInfoModelStore.set(taginfos)
}
const tableActions = (action: CustomEvent<{ row: TagInfoModel; type: string }>) => {
// See tableCRUDActions tab for more details
const { type, row } = action.detail;
console.log("🚀 ~ tableActions ~ action.detail:", action.detail)
switch (type) {
case 'SAVE':
saveFn(row);
break;
case 'UPDATE':
// updateFn(row);
break;
default:
break;
}
};
async function saveFn(tagInfo: TagInfoModel) {
const responce = await save(tagInfo);
if(responce.status === 200){
notificationStore.showNotification({
notificationType: notificationType.success,
message: 'Tag is saved.'
})
console.log('ok');
}else{
notificationStore.showNotification({
notificationType: notificationType.error,
message: 'Tag is not saved.'
})
}
}
</script>
<Page
title="Tag Overview"
note="Tag Infomations about a version"
contentLayoutType={pageContentLayoutType.full}
contentLayoutType={pageContentLayoutType.center}
>

{#await reload()}
<div class="table-container w-full">
<TablePlaceholder cols={7} />
</div>
{:then model}
<div class="table table-compact w-full">

<Table
on:action={tableActions}
config={{
id:"taginfos",
search:false,
data: tagInfoModelStore,
optionsComponent: TableOptions,
columns:{
versionId: {
disableFiltering: true,
exclude: true
},
tagId: {
disableFiltering: true,
exclude: true
},
versionNr: {
fixedWidth:10,
header:"Internal version",
disableFiltering:true,
disableSorting:true
},
tagNr: {
fixedWidth:80,
header:"Tag",
disableFiltering:true,
disableSorting:true,
instructions:{
renderComponent:TableNr
}
},
releaseNote: {
header:"Release Note",
fixedWidth:400,
disableFiltering:true,
disableSorting:true,
instructions:{
renderComponent:TableReleaseNote
}
},
releaseDate: {
header:"Release Date",
instructions:{
renderComponent:TableDate
},
disableFiltering:true,
disableSorting:true
},
systemDescription: {
header:"System Description",
disableFiltering:true,
disableSorting:true
},
systemAuthor: {
header:"System Author",
disableFiltering:true,
disableSorting:true
},
systemDate: {
header:"System Date",
instructions:{
renderComponent:TableDate
},
disableFiltering:true,
disableSorting:true
},
show:{
header:"Show history",
fixedWidth:10,
instructions:{
renderComponent:TableShow
},
disableFiltering:true,
disableSorting:true
},
publish:{
header:"Publish dataset",
fixedWidth:10,
instructions:{
renderComponent:TablePublish
},
disableFiltering:true,
disableSorting:true
}
}
}}>
</Table>

</div>
{:catch error}
<ErrorMessage {error} />
{/await}

</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { Api } from '@bexis2/bexis2-core-ui';
/* Overview Variable Template*/
/****************/

export const getTagInfos = async (id) => {
export const get = async (id) => {
try {
const response = await Api.get('/api/TagInfo/'+id);
const response = await Api.get('/api/taginfo/'+id);
console.log("🚀 ~ getTagInfos ~ response:", response)

return response.data;
Expand All @@ -24,8 +24,7 @@ export const save = async (model:TagInfoModel) => {
const response = await Api.post('/api/TagInfo/',model);
console.log("🚀 ~ save ~ response:", response)


return response.data;
return response;
} catch (error) {
console.error(error);
throw error;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { TagInfoModel } from './types';
import { writable } from 'svelte/store';

export const tagInfoModelStore = writable<TagInfoModel[]>([]);

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script lang="ts">
import type { TagInfoModel } from '../types';
export let value: string;
export let row: TagInfoModel;
let emtpy:boolean = true;
emtpy = isEmpty(value)
function isEmpty(value: string): boolean {
if(value === null || value === undefined || value === '' || value === '0001-01-01T00:00:00') {
return true;
}
return false;
}
</script>
{#if !emtpy}
{new Date(value).toLocaleString("de-DE")}
{/if}

Loading

0 comments on commit 3171c06

Please sign in to comment.