Pages durch Widgets ablösen #2
|
|
@ -1,6 +1,37 @@
|
|||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ namespace _dali.type
|
|||
* extern eingebundene Events kodiert
|
||||
*
|
||||
* @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 = {
|
||||
id : event_id;
|
||||
id : (null | local_resource_event_id);
|
||||
key : event_key;
|
||||
object : event_object;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -17,13 +17,6 @@ namespace _dali.pages.overview
|
|||
target_element.querySelector("#overview").classList.toggle("overview-compact", compact);
|
||||
};
|
||||
|
||||
/**
|
||||
* @todo geschickter bauen (MVC, MVVM, …)
|
||||
*/
|
||||
const update = () => {
|
||||
lib_plankton.zoo_page.reload();
|
||||
};
|
||||
|
||||
// exec
|
||||
target_element.innerHTML = await _dali.helpers.template_coin(
|
||||
"overview",
|
||||
|
|
@ -66,6 +59,12 @@ namespace _dali.pages.overview
|
|||
|
||||
let widget_weekview : _dali.widgets.weekview.class_widget_weekview;
|
||||
let widget_listview : _dali.widgets.listview.class_widget_listview;
|
||||
/**
|
||||
* @todo update sources
|
||||
*/
|
||||
const update = () => {
|
||||
widget_weekview.update_entries();
|
||||
};
|
||||
// hint
|
||||
{
|
||||
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) => {
|
||||
/*
|
||||
if (! await _dali.backend.is_logged_in())
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
*/
|
||||
let read_only : boolean;
|
||||
switch (access_level)
|
||||
{
|
||||
|
|
@ -304,6 +312,15 @@ namespace _dali.pages.overview
|
|||
{
|
||||
"action_select_event": action_select_event,
|
||||
"action_select_day": (date) => {
|
||||
/*
|
||||
if (! await _dali.backend.is_logged_in())
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
*/
|
||||
(async () => {
|
||||
const widget = new _dali.widgets.event_edit.class_widget_event_edit(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
access_level : _dali.type.enum_access_level
|
||||
) : ("none" | "view" | "edit" | "admin")
|
||||
|
|
@ -28,6 +38,7 @@ namespace _dali.backend
|
|||
|
||||
|
||||
/**
|
||||
* meant for translation of the API values
|
||||
*/
|
||||
function access_level_decode(
|
||||
access_level_encoded : ("none" | "view" | "edit" | "admin")
|
||||
|
|
@ -52,6 +63,14 @@ namespace _dali.backend
|
|||
"corner": "zeitbild",
|
||||
}
|
||||
);
|
||||
_cache = lib_plankton.cache.make<boolean>(
|
||||
/*
|
||||
lib_plankton.storage.memory.implementation_chest(
|
||||
{
|
||||
}
|
||||
)
|
||||
*/
|
||||
);
|
||||
return Promise.resolve<void>(undefined);
|
||||
}
|
||||
|
||||
|
|
@ -162,19 +181,27 @@ namespace _dali.backend
|
|||
|
||||
|
||||
/**
|
||||
* @todo mneh …
|
||||
*/
|
||||
export async function is_logged_in(
|
||||
) : Promise<boolean>
|
||||
{
|
||||
// return ((await get_session_key()) !== null);
|
||||
const result : {
|
||||
logged_in : boolean;
|
||||
} = await call(
|
||||
lib_plankton.http.enum_method.get,
|
||||
"/session/status",
|
||||
null
|
||||
return lib_plankton.cache.get(
|
||||
_cache,
|
||||
"status",
|
||||
5,
|
||||
async () => {
|
||||
// return ((await get_session_key()) !== null);
|
||||
const result : {
|
||||
logged_in : boolean;
|
||||
} = await call(
|
||||
lib_plankton.http.enum_method.get,
|
||||
"/session/status",
|
||||
null
|
||||
);
|
||||
return result.logged_in;
|
||||
}
|
||||
);
|
||||
return result.logged_in;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -596,12 +623,20 @@ namespace _dali.backend
|
|||
export async function events(
|
||||
from_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>);
|
||||
} = {}
|
||||
}
|
||||
=
|
||||
{
|
||||
}
|
||||
) : Promise<
|
||||
Array<
|
||||
{
|
||||
key : _dali.type.event_key;
|
||||
calendar_id : _dali.type.calendar_id;
|
||||
calendar_name : string;
|
||||
hue : float;
|
||||
|
|
@ -612,13 +647,6 @@ namespace _dali.backend
|
|||
>
|
||||
>
|
||||
{
|
||||
options = Object.assign(
|
||||
{
|
||||
"calendar_ids": null,
|
||||
},
|
||||
options
|
||||
);
|
||||
|
||||
return (
|
||||
call(
|
||||
lib_plankton.http.enum_method.get,
|
||||
|
|
@ -629,11 +657,11 @@ namespace _dali.backend
|
|||
"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
|
||||
.map(
|
||||
(entry) => ({
|
||||
"key": entry.hash,
|
||||
"calendar_id": entry.calendar_id,
|
||||
"calendar_name": entry.calendar_name,
|
||||
"hue": entry.hue,
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -12,7 +12,6 @@
|
|||
<span>{{label_control_count}}</span>
|
||||
<input type="number"/>
|
||||
</label>
|
||||
<input type="submit" class="weekview-control weekview-control-apply" value="{{label_control_apply}}"/>
|
||||
</div>
|
||||
<div class="weekview-table">
|
||||
<table>
|
||||
|
|
|
|||
Loading…
Reference in a new issue