[task-408] [mod] Wochenansich-Steuerelement umgestellt

This commit is contained in:
fenris 2025-10-14 22:10:56 +02:00
parent 7e1f585f34
commit 4612128134
6 changed files with 676 additions and 933 deletions

View file

@ -1,6 +1,37 @@
namespace _dali namespace _dali
{ {
/**
*/
export function access_level_encode(
access_level : _dali.type.enum_access_level
) : ("none" | "view" | "edit" | "admin")
{
switch (access_level) {
case _dali.type.enum_access_level.none: return "none";
case _dali.type.enum_access_level.view: return "view";
case _dali.type.enum_access_level.edit: return "edit";
case _dali.type.enum_access_level.admin: return "admin";
}
}
/**
*/
export function access_level_decode(
representation : /*("none" | "view" | "edit" | "admin")*/string
) : _dali.type.enum_access_level
{
switch (representation)
{
case "none": return _dali.type.enum_access_level.none;
case "view": return _dali.type.enum_access_level.view;
case "edit": return _dali.type.enum_access_level.edit;
case "admin": return _dali.type.enum_access_level.admin;
default: throw (new Error("invalid access level representation: " + representation));
}
}
/** /**
*/ */

View file

@ -42,9 +42,9 @@ namespace _dali.type
* extern eingebundene Events kodiert * extern eingebundene Events kodiert
* *
* @example "local:1234" * @example "local:1234"
* @example "ics:2345" * @example "ics~2345"
*/ */
export type event_id = string; export type event_key = string;
/** /**
@ -78,7 +78,8 @@ namespace _dali.type
/** /**
*/ */
export type event_entry = { export type event_entry = {
id : event_id; id : (null | local_resource_event_id);
key : event_key;
object : event_object; object : event_object;
}; };

View file

@ -17,13 +17,6 @@ namespace _dali.pages.overview
target_element.querySelector("#overview").classList.toggle("overview-compact", compact); target_element.querySelector("#overview").classList.toggle("overview-compact", compact);
}; };
/**
* @todo geschickter bauen (MVC, MVVM, )
*/
const update = () => {
lib_plankton.zoo_page.reload();
};
// exec // exec
target_element.innerHTML = await _dali.helpers.template_coin( target_element.innerHTML = await _dali.helpers.template_coin(
"overview", "overview",
@ -66,6 +59,12 @@ namespace _dali.pages.overview
let widget_weekview : _dali.widgets.weekview.class_widget_weekview; let widget_weekview : _dali.widgets.weekview.class_widget_weekview;
let widget_listview : _dali.widgets.listview.class_widget_listview; let widget_listview : _dali.widgets.listview.class_widget_listview;
/**
* @todo update sources
*/
const update = () => {
widget_weekview.update_entries();
};
// hint // hint
{ {
if (! await _dali.backend.is_logged_in()) if (! await _dali.backend.is_logged_in())
@ -176,6 +175,15 @@ namespace _dali.pages.overview
} }
); );
const action_select_event = (calendar_id, access_level, event_id) => { const action_select_event = (calendar_id, access_level, event_id) => {
/*
if (! await _dali.backend.is_logged_in())
{
// do nothing
}
else
{
}
*/
let read_only : boolean; let read_only : boolean;
switch (access_level) switch (access_level)
{ {
@ -304,6 +312,15 @@ namespace _dali.pages.overview
{ {
"action_select_event": action_select_event, "action_select_event": action_select_event,
"action_select_day": (date) => { "action_select_day": (date) => {
/*
if (! await _dali.backend.is_logged_in())
{
// do nothing
}
else
{
}
*/
(async () => { (async () => {
const widget = new _dali.widgets.event_edit.class_widget_event_edit( const widget = new _dali.widgets.event_edit.class_widget_event_edit(
{ {

View file

@ -14,6 +14,16 @@ namespace _dali.backend
/** /**
*/ */
var _cache : (
null
|
lib_plankton.cache.type_subject<boolean>
);
/**
* meant for translation of the API values
*/
function access_level_encode( function access_level_encode(
access_level : _dali.type.enum_access_level access_level : _dali.type.enum_access_level
) : ("none" | "view" | "edit" | "admin") ) : ("none" | "view" | "edit" | "admin")
@ -28,6 +38,7 @@ namespace _dali.backend
/** /**
* meant for translation of the API values
*/ */
function access_level_decode( function access_level_decode(
access_level_encoded : ("none" | "view" | "edit" | "admin") access_level_encoded : ("none" | "view" | "edit" | "admin")
@ -52,6 +63,14 @@ namespace _dali.backend
"corner": "zeitbild", "corner": "zeitbild",
} }
); );
_cache = lib_plankton.cache.make<boolean>(
/*
lib_plankton.storage.memory.implementation_chest(
{
}
)
*/
);
return Promise.resolve<void>(undefined); return Promise.resolve<void>(undefined);
} }
@ -162,10 +181,16 @@ namespace _dali.backend
/** /**
* @todo mneh
*/ */
export async function is_logged_in( export async function is_logged_in(
) : Promise<boolean> ) : Promise<boolean>
{ {
return lib_plankton.cache.get(
_cache,
"status",
5,
async () => {
// return ((await get_session_key()) !== null); // return ((await get_session_key()) !== null);
const result : { const result : {
logged_in : boolean; logged_in : boolean;
@ -176,6 +201,8 @@ namespace _dali.backend
); );
return result.logged_in; return result.logged_in;
} }
);
}
/** /**
@ -596,12 +623,20 @@ namespace _dali.backend
export async function events( export async function events(
from_pit : lib_plankton.pit.type_pit, from_pit : lib_plankton.pit.type_pit,
to_pit : lib_plankton.pit.type_pit, to_pit : lib_plankton.pit.type_pit,
options : { {
"calendar_ids": calendar_ids = null,
}
:
{
calendar_ids ?: (null | Array<_dali.type.calendar_id>); calendar_ids ?: (null | Array<_dali.type.calendar_id>);
} = {} }
=
{
}
) : Promise< ) : Promise<
Array< Array<
{ {
key : _dali.type.event_key;
calendar_id : _dali.type.calendar_id; calendar_id : _dali.type.calendar_id;
calendar_name : string; calendar_name : string;
hue : float; hue : float;
@ -612,13 +647,6 @@ namespace _dali.backend
> >
> >
{ {
options = Object.assign(
{
"calendar_ids": null,
},
options
);
return ( return (
call( call(
lib_plankton.http.enum_method.get, lib_plankton.http.enum_method.get,
@ -629,11 +657,11 @@ namespace _dali.backend
"to": to_pit, "to": to_pit,
}, },
( (
(options.calendar_ids === null) (calendar_ids === null)
? ?
{} {}
: :
{"calendar_ids": options.calendar_ids.join(",")} {"calendar_ids": calendar_ids.join(",")}
) )
) )
) )
@ -642,6 +670,7 @@ namespace _dali.backend
data data
.map( .map(
(entry) => ({ (entry) => ({
"key": entry.hash,
"calendar_id": entry.calendar_id, "calendar_id": entry.calendar_id,
"calendar_name": entry.calendar_name, "calendar_name": entry.calendar_name,
"hue": entry.hue, "hue": entry.hue,

File diff suppressed because it is too large Load diff

View file

@ -12,7 +12,6 @@
<span>{{label_control_count}}</span> <span>{{label_control_count}}</span>
<input type="number"/> <input type="number"/>
</label> </label>
<input type="submit" class="weekview-control weekview-control-apply" value="{{label_control_apply}}"/>
</div> </div>
<div class="weekview-table"> <div class="weekview-table">
<table> <table>