Diplay loading indicator for FullCalendar and Vuejs - vue.js

is there a way to display a loading indicator on FullCalendar 5 and VueJS ?
https://fullcalendar.io/docs/loading
I checked the documentation and it states it works via AJAX request, but don't say anything about other technologies.
Is there any way to have something similar and easy to implement ?
Regards.
When i get my agendas entries, i update my calendars with the events.
entreesAgenda() {
// Ajout des evenements dans le(s) calendrier(s)
let entrees = []
if (this.entreesAgenda) {
for (let i = 0; i < this.utilisateurs.length; i++) {
entrees = this.data.items.filter(
(f) => f.idPersonnel === this.utilisateurs[i].id
)
// Mise à jour des businessHours
this.$refs.utilisateur[i]
.getApi()
.setOption('businessHours', this.calculBusinessHours(entrees))
// Insertion des entrees d'agenda dans le calendrier
for (let m = 0; m < entrees.length; m++) {
this.$refs.utilisateur[i].getApi().addEvent(entrees[m])
}
}
}
this.updateView()
},
But i don't know how to use the loading.

Related

import binance api data into google sheet

I'm just a newbie trying to import raw binance api data into a google sheet. I tried using Mixed Analytics API Connector but the result is usually "completed with errors". And the support team suggestions didn't help at all with the end result still the same and so the data is still the same from its previous data that was a week old already.
You could see the raw binance api data on the link below.
https://api.binance.com/api/v3/ticker/24hr
And so I think it, the way only to tackle this problem would be to code it as a google script.
I would greatly appreciate any help I can get.
Any sample code gs code would be very helpful.
Thank you very much...
Here is a solution. Put a triger if needed on the function horodatage (i.e. each day)
// Mike Steelson
let resultat = [];
// mettre déclencheur horaire sur cette fonction
// define a trigger here
function horodatage(){
var f = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data')
f.getRange('A1').setValue(!f.getRange('A1').getValue())
f.getRange('B1').setValue(new Date())
}
function getDataJSON(url,xpath){
try{
if (url.match(/http(s)?:\/\/?/g)){var data = JSON.parse(UrlFetchApp.fetch(url).getContentText())}
else{var data = JSON.parse(url)}
var json = eval('data')
if (typeof xpath == 'object'){var liste = xpath.join().split(",")} else {var liste = xpath.split("|")}
if (json.length){json.forEach(function(elem){getData(elem,liste)})} else {getData(json,liste)}
return resultat
}
catch(e) {
return ('Pas de résultat - vérifier l\'url et les paramètres !');
}
}
function getData(elem,liste){
var prov=[]
liste.forEach(function(chemin){
var t=chemin.split('/');
var obj=elem;
for (var i=1;i<t.length;i++){obj=obj.item(t[i])}
if(typeof obj=='object'){prov.push('['+obj+']')}else{prov.push(obj)}
})
resultat.push(prov)
}
Object.prototype.item=function(i){return this[i]};
you can take a copy of this spreadsheet https://docs.google.com/spreadsheets/d/1DN0Gfim0LC098zVgrUpt2crPWUn4pWfZnCpuuL1ZiMs/copy
i cannot comment but here could be a solution, instead of api.binance.com/api/v3/ticker/24hr write api1.binance.com/api/v3/ticker/24hr
I have added 1 to api. in a video I saw it works for him.... but for me didnt work.
let me know if it was useful
thanks

Vue.Js draw lines between components problem

I am using SVGs to draw lines between components that are related in my app. Currently I am grabbing those elements and getting their position info with document.getElementById() and then using getClientBoundingRect.
This generally works, but there is occasional render wonkiness.
Is there a better way to do this? Perhaps an already existing library that works with VueJs?
Changing the class puts a CSS filter on the shape because you have
.isSelected {
filter: brightness(50%);
}
Now the W3C Filter Effects spec says
The application of the ‘filter’ property to an element formatted with the CSS box model establishes a new stacking context the same way that CSS ‘opacity’ does, and all the element's descendants are rendered together as a group with the filter effect applied to the group as a whole.
So browsers are doing the correct thing per that specification. The new stacking context puts the shape in front of the line.
See also this wontfixed Chromium bug
The problem ended up being because of document.getElementById and z-order
I ended up changing my timer to get the element by ref, and iterate through the children of my component to find it.
Here is the code:
drawLines: function () {
let children = this.$children
let lines = this.lines
lines.splice(0, lines.length)
let scheduleContainer = this.$refs.scheduleContainer
let scheduleContainerRect = scheduleContainer.getBoundingClientRect();
for (let i = 0; i < children.length; i++) {
let child = children[i]
if (child.$props.assignment) {
if (child.$props.assignment.assignmentRequestId != "00000000-0000-0000-0000-000000000000") {
for (let ii = 0; ii < children.length; ii++) {
let child2 = children[ii]
if (child2.$props.assignmentRequest) {
if (child2.$props.assignmentRequest.id == child.$props.assignment.assignmentRequestId) {
let assignmentRect = child.$refs.theContainer.getBoundingClientRect()
let requestRect = child2.$refs.theContainer.getBoundingClientRect()
let x1 = ((assignmentRect.left - scheduleContainerRect.left) + 12.5) + 'px'
let y1 = ((assignmentRect.top - scheduleContainerRect.top) + 12.5) + 'px'
let x2 = ((requestRect.left - scheduleContainerRect.left) + 12.5) + 'px'
let y2 = ((requestRect.top - scheduleContainerRect.top) + 12.5) + 'px'
let line = { 'x1': x1, 'y1': y1, 'x2': x2, 'y2': y2 }
lines.push(line)
}
}
}
}
}
}
},

Enterprise Architect -> How to get the edge of the end node using a SQL Query on the .eap-File (.mdb)

I have to draw some EA diagrams using only the .eap file without an installed EA on the server. So I am opening it as MDB-File via ODBC.
I know there is the attribute t_diagramlinks.Geometry (with edge={1,2,3,4}) and the Attribute t_connector.Start_Edge and the attribute t_connector.End_Edge.
The table t_diagramlinks with the attribute Geometry is diagram-dependent.
The table t_connector with the attributes .Start_Edge and .End_Edge is not diagram-dependent --> there could be connections that haven't been drawn on a diagram.
I know that the SX, SY, EX, EY of t_diagramlinks are coordinates relative to the origin of each node that is drawn on a diagram.
Problem: EX / EY sometimes is zero and isn't painting the end line to the edge of the node. I guess it has something to do with mouse release position.
"My Interpretation" below is what my renderer produces based on my assumptions.
"EA Interpretation" is what EA is actually rendering and which I would like to see in my renderer as well.
Questions
I am using the csv-Value EDGE in t_diagramlinks.Geometry - but where
do I find this for the end node?
For which purpose are the attributes Start_Edge an End_Edge in the
table t_connector when it is not diagram-dependent?
I am using in t_diagramlinks.Geometry the csv-Value EDGE - but where
do i find this for the end node?
You need to use Euclide. SX,SY/EX,EY are relative shifts from the shortest center connection between start and end element.
For which purpose are the attributes Start_Edge an End_Edge in the
table "t_connector" when it is not diagram-dependend?
They are used for qualified properties.
Edit: To elaborate a bit more on your basic issue. t_diagramlinks.path holds bending points for the connector (if any are specified). So in order to find the point where a connector actually joins an element you have to find the nearest bend to that element. Now between this bend and the middle of the element you will have a natural attachment point. Relative to that the SX-Y (/EX-Y) are added to make the manually shifted rendered attachment point.
The above goes with a grain of salt. I never verified the nitty gritty but used my stomach from seeing the numbers. I might look into that in detail to update my Inside book but can't promise.
2nd Edit: Now that I know that "My Interpretation" is what your renderer produces based on your assumptions, here's the (most likely; see above) story. In order to render a connector EA will use the following information:
the frame coordinates of the two connected elements
calculated from the coordinates the middle point of the elements
the path property of the connector (if not empty)
the nearest bending point to the relevant elements (if not empty)
the shift factors SX-Y and EX-Y for the connector
Starting from the start element's middle point you draw a virtual line to either the nearest bending point or the middle of the end element (unless see below). That way you can calculate the virtual attachment point at the element's rectangular frame (even use cases have a rectangular frame). Now you shift that point by SX-Y which will (/should?) always travel along the edge of the element frame. Now you have the virtual attachment point for the start element.
On the other side (the end element; my "unless" from above) you would do a similar thing to calculate the virtual attachment for the end. What I don't know is the real order in which EA is doing that (I have no code insight). So if you have manual offsets on both sides the calculation will give different results depending on the order to draw the virtual connection to the other side (so: is the shift on the other side respected or not). Basically I think you can neglect that for 99.9% of all cases and the rest is just irrelevant noise.
So now you know the virtual end points you either connect them directly or, if a path is give, you connect them via the bending points.
Again: all with a grain of salt. It's just observation from the outside but likely not too far away. There's also the fact that you have different line styles with rounded edges (not taken into account here) and bezier lines (even more dragon land).
Thank you very much. I choosed to calculate the End-Edge mathematically:
My problem was, that i wasn't able to detect the end edge of the target endnode on a link relation. Further more there are 8 different link types, that are determining the layout of the links. So as Thomas mentioned i had to detect the last point before the endpoint. If it is a path, the last node of the path is the point before the endpoint. If there is not a path, the startnodes starting point is the last point before the endpoint. But if there is a path defined and the link mode has been set to 1 i may not process the connection path, because the Conn_Path property is containing a customized line - but after customizing the user has selected to have a direct link (it will not be deleted).
The mathematic behind is used as linear function y=m*x+b and the lines are described by 4 straight lines which are appropriate to the edges of the endnode.
So you can do the following algorithm:
The complete algorithm is using the following approach:
1.) Determine straight line between start- and endnode (there are 2 special cases if the line is completely horizontal or vertically parallel to the coordinate system)
2.) Create a rectangle which consists of four straight lines (2 vertical / 2 horizontal lines)
3.) Determine the intersection of the first straight line with the rectangles lines
4.) Exclude point that are not consisting to the rectangle
5.) Determine the point on the rectangle with the shortest distance => this is the searched end edge point
The written javascript code i have used to do the routing is the following:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Erzeuge eine eigene Link-Klasse für das Routing der Pfeile, die von Hand gezogen wurden
// und über spezielle Attribute in der EAP-Datei definiert werden
// Ruft die Superklasse von go.Link im Konstruktor auf
function MultiNodePathLink() {
go.Link.call(this);
}
go.Diagram.inherit(MultiNodePathLink, go.Link); // Erben von go.Link
// ignores this.routing, this.adjusting, this.corner, this.smoothness, this.curviness
/** #override */
MultiNodePathLink.prototype.computePoints = function () {
// Die this Referenz ist hier ist ein geerbter ein go.Link. der bei Links
var startNode = this.fromNode;
var startNodeX = startNode.location.M; // X-Koordinate vom Startknoten
var startNodeY = startNode.location.N; // Y-Koordinate vom Startknoten
var endNode = this.toNode;
var endNodeX = endNode.location.M; // X-Koordinate vom Startknoten
var endNodeY = endNode.location.N; // Y-Koordinate vom Startknoten
var startNodeData = startNode.data; // Das sind die Daten
var endNodeData = endNode.data; // Das sind die Daten
// Die Link-Daten
var linkProperties = this.data;
//** Das Feld Style in [t_diagramlink] bestimmt die Connector-Darstellung **/
// http://www.capri-soft.de/blog/?p=2904
/*
* 1 = Direct Mode=1
* 2 = Auto Routing Mode=2
* 3 = Custom Line Mode=3
* 4 = Tree Vertical Mode=3;TREE=V
* 5 = Tree Horizontal Mode=3;TREE=H
* 6 = Lateral Vertical Mode=3;TREE=LV
* 7 = Lateral Horizontal Mode=3;TREE=LH
* 8 = Orthogonal Square Mode=3;TREE=OS
* 9 = Orthogonal Rounded Mode=3;TREE=OR
*/
var styleStringArray = linkProperties.style.split(";");
var mode = -1;
var tree = '';
for (var i = 0; i < styleStringArray.length; i++) {
if (styleStringArray[i].trim().indexOf('Mode=') > -1) {
mode = styleStringArray[i].replace('Mode=', '');
}
if (styleStringArray[i].trim().indexOf('TREE=') > -1) {
tree = styleStringArray[i].replace('TREE=', '');
}
}
// In der Tabelle t_diagramlinks in der Freitextspalte "Geometry" wird in einem CSV-String
// gespeichert, wie der Link letztendlich auf dem Diagram gezogen wurde
var geometryString = linkProperties.geometry.split(";");
// SX and SY are relative to the centre of the start object
var sx = geometryString[0].replace("SX=", "");
var sy = geometryString[1].replace("SY=", "");
// EX and EY are relative to the centre of the end object
var ex = geometryString[2].replace("EX=", "");
var ey = geometryString[3].replace("EY=", "");
// SX=-67;SY=-43;EX=-12;EY=-40;EDGE=3;$LLB=;
// LLT=;LMT=;LMB=CX=30:CY=13:OX=11:OY=-2:HDN=0:BLD=0:ITA=0:UND=0:CLR=-1:ALN=1:DIR=0:ROT=0;
// LRT=;LRB=;IRHS=;ILHS=;
// EDGE ranges in value from 1-4, with 1=Top, 2=Right, 3=Bottom, 4=Left (Outgoing Point of the Start Object)
var edge = geometryString[4].replace("EDGE=", "");
// Hier beginnt das Custom-Routing
this.clearPoints();
if (linkProperties.start_object_name == 'System Verification Test Reports' && linkProperties.end_object_name == 'System test specifications') {
var test = 'irrsinn';
}
// Hier werden die Wege definiert für das gecustomizte Link Routing
// Geht der Link nach oben oder unten wird die Y-Koordinate des Startknotens genutzt (Weil Orthogonales Routing)
var startConnX = null;
var startConnY = null;
if (edge == 1) { // Ecke oben
startConnX = Math.abs(startNodeX) + Math.abs((startNode.actualBounds.width / 2) + new Number(sx));
startConnY = Math.abs(startNodeY);
}
else if (edge == 3) { // Ecke unten
startConnX = Math.abs(startNodeX) + Math.abs((startNode.actualBounds.width / 2) + new Number(sx));
startConnY = Math.abs(startNodeY) + new Number(startNode.actualBounds.height);
}
else if (edge == 2) { // Ecke rechts
startConnX = Math.abs(startNodeX) + startNode.actualBounds.width;
startConnY = Math.abs(startNodeY) + Math.abs((startNode.actualBounds.height / 2) - new Number(sy));
}
else if (edge == 4) { // Ecke links
startConnX = new Number(Math.abs(startNodeX));
startConnY = Math.round(startNodeY) + Math.round((startNode.actualBounds.height / 2) - new Number(sy));
}
else {
alert('Die Edge konnte nicht entdeckt werden! Ist der Geometry String in der EAP Datei richtig?');
}
this.addPoint(new go.Point(Math.round(startConnX), Math.round(startConnY)));
// Abfrage: Gibt es einen letzten Path Punkt?
var lastPathPunkt=false;
var lastPathPunktX, lastPathPunktY;
if (mode != 1)
{
// Routing über die Zwischenwege
if (typeof linkProperties.conn_path !== "undefined" && linkProperties.conn_path !== "") {
var splittedArray = linkProperties.conn_path.split(";");
if (splittedArray.length > 1) {
// Hier ist mindestens ein Wert vorhanden da auch der erste mit Semikolon abgeschlossen wird im Path vom EA
for (var i = 0; i < splittedArray.length - 1; i++) {
var einMittelPunkt = splittedArray[i];
var mittelPunktArray = einMittelPunkt.split(":");
this.addPoint(new go.Point(Math.abs(new Number(mittelPunktArray[0])), Math.abs(new Number(mittelPunktArray[1]))))
lastPathPunktX = Math.abs(new Number(mittelPunktArray[0]));
lastPathPunktY = Math.abs(new Number(mittelPunktArray[1]));
lastPathPunkt = true;
}
}
}
}
// Wenn es keinen Pfad gab,muss der letzte Punkt mit dem Startknoten identisch sein
if (lastPathPunkt == false) {
lastPathPunktX = Math.abs(Math.round(startConnX));
lastPathPunktY = Math.abs(Math.round(startConnY));
}
// End-Routing
// Der Endpunkt in EA in Document Coordinates
var endConnX = Math.abs(endNodeX) + Math.abs((endNode.actualBounds.width / 2) + new Number(ex));
var endConnY = Math.abs(endNodeY) + Math.abs((endNode.actualBounds.height / 2) - new Number(ey));
// Spezialfälle bei horizontalen und vertikalen Linien:
if (endConnX == lastPathPunktX) {
// Es liegt eine vertikale Gerade (z.B. von oben nach unten) vor
this.addPoint(new go.Point(Math.round(lastPathPunktX), Math.round(lastPathPunktY)));
this.addPoint(new go.Point(Math.round(endConnX), Math.round(endConnY)));
} else if (endConnY == lastPathPunktY) {
// Es liegt eine horizontale Gerade (z.B. von rechts nach links) vor
this.addPoint(new go.Point(Math.round(lastPathPunktX), Math.round(lastPathPunktY)));
this.addPoint(new go.Point(Math.round(endConnX), Math.round(endConnY)));
} else {
// Es ist keine Gerade sondern ein Gerade, die mit y=m*x+b beschrieben werden kann
// 1.) Gerade zwischen Start- und Endpunkt ermittelnhn
// Ye-Ys
// m = ----- b=Ys-m*Xs oder b=Ye-m*Xe
// Xe-Xs
var m = (endConnY - lastPathPunktY) / (endConnX - lastPathPunktX);
var b = lastPathPunktY - m * lastPathPunktX
// 2.) Ermittlung der horizontalen und vertikalen Geraden des Rechteckes und dem Schnittpunkten
// Die Geraden, die das Rechteck definieren:
var rY1 = endNodeY;
var rY2 = endNodeY + endNode.actualBounds.height;
var rX1 = endNodeX;
var rX2 = endNodeX + endNode.actualBounds.width;
// (rX1, rY1) -zu-> (rX2, rY2)
// Horizontale Geraden:
// y - b
// x = -----
// m
var lengthToPoint = [];
var sX1 = (rY1 - b) / m; // S1(sX1|rY1)
if (sX1 >= rX1 && sX1 <= rX2) {
// Der Schnittpunkt sX1 ist am Rechteck
// Distanz: d=SQRT((y2-y1)^2+(x2-x1)^2)
var dS1 = Math.sqrt(Math.pow(rY1 - lastPathPunktY, 2) + Math.pow(sX1 - lastPathPunktX, 2));
lengthToPoint.push({
"distanz": dS1,
"x": sX1,
"y": rY1
});
}
var sX2 = (rY2 - b) / m; // S2(sX2|rY2)
if (sX2 >= rX1 && sX2 <= rX2) {
// Der Schnittpunkt sX2 ist am Rechteck
// Distanz: d=SQRT((y2-y1)^2+(x2-x1)^2)
var dS2 = Math.sqrt(Math.pow(rY2 - lastPathPunktY, 2) + Math.pow(sX2 - lastPathPunktX, 2));
lengthToPoint.push({
"distanz": dS2,
"x": sX2,
"y": rY2
});
}
// Vertikale Geraden:
//
// y = m*x + b
var sY1 = m * rX1 + b; // S3(rX1|sY1)
if (sY1 >= rY1 && sY1 <= rY2) {
// Der Schnittpunkt sY1 ist am Rechteck
// Distanz: d=SQRT((y2-y1)^2+(x2-x1)^2)
var dS3 = Math.sqrt(Math.pow(sY1 - lastPathPunktY, 2) + Math.pow(rX1 - lastPathPunktX, 2));
lengthToPoint.push({
"distanz": dS3,
"x": rX1,
"y": sY1
});
}
var sY2 = m * rX2 + b; // S4(rX2|sY2)
if (sY2 >= rY1 && sY2 <= rY2) {
// Der Schnittpunkt sY2 ist am Rechteck
// Distanz: d=SQRT((y2-y1)^2+(x2-x1)^2)
var dS4 = Math.sqrt(Math.pow(sY2 - lastPathPunktY, 2) + Math.pow(rX2 - lastPathPunktX, 2));
lengthToPoint.push({
"distanz": dS4,
"x": rX2,
"y": sY2
});
}
// Sortiere alle Punkte nach Distanz - der mit der kleinsten Entfernung isses
lengthToPoint.sort(function (a, b) { return a.distanz - b.distanz });
if (lengthToPoint.length > 0)
{
this.addPoint(new go.Point(Math.round(lengthToPoint[0].x), Math.round(lengthToPoint[0].y)));
}
else
{
this.addPoint(new go.Point(Math.round(lastPathPunktX), Math.round(lastPathPunktY)));
}
}
return true;
};
// end MultiNodePathLink class

How can i display multiple views with ModuleFrontController in PS 1.6

With my Module Front Controller, i need to initialize it to display a form (formulaire.tpl) that the customer has to fill. Then the controller processes the data posted from the form using methods defines in my model (Formulaire.php) and then i would like to make it display another view (recapitulatif.tpl) that displays a reminder of data sent, an add to cart button for example or the possibility to fill the form in again.
As i would like to implement it the MVC way, i don't want to create a new php page to redirect my customer to but i would like to display somehow this second template after processing the data. Is there any way to do so with the controller? Here below, you can find my code, it doesn't work and it displays my first template and below my second..
class FormulaireModuleDefaultModuleFrontController extends ModuleFrontController
{
public $ssl = true;
private $done_traitement = false;
public function postProcess()
{
//On vérifie le bouton submit du formulaire
if(Tools::isSubmit('bouton'))
{
// On va commencer en premier par récupérer l'id customer avec la variable cookie
// et vérifier que la personnes est bien loggée
global $cookie;
if(!isset($cookie->id_customer))
{
$message='Aucun client loggé';
}
else
{
$errors=array();
$id_cart=$this->context->cart->id;
$customer=$cookie->id_customer;
//On récupère les valeurs du formulaire
$prix=Tools::getValue('resultat');
$titre='porte_test';
$desc='Largeur de passage de '.Tools::getValue('largeur_passage').' mm, hauteur de passage de '.Tools::getValue('hauteur_passage')
.' mm, hauteur de linteau de '.Tools::getValue('hauteur_linteau').' mm, ecoinçon gauche de '.Tools::getValue('ecoincon_gauche')
.' mm, ecoincon_droit de '.Tools::getValue('ecoincon_droit'). ' mm, motif en '.Tools::getValue('motif_porte').' et de couleur '
.Tools::getValue('couleur_porte');
//On va vérifier les champs obligatoires
//Les champs sont remplis, on va faire le traitement des données.
$idprod=Formulaire::creerProduct($titre,0,13,$prix,$desc, 'mod_100',$customer);
Formulaire::addProduitauPanier($idprod);
$this->done_traitement=true;
}
//On envoie le message si il existe:
if(isset($message))self::$smarty->assign('message',$message);
if(isset($errors))self::$smarty->assign('erreurs',$errors);
}
}
public function initContent()
{
parent::initContent();
if($this->done_traitement)
$this->display(__FILE__,'recapitulatif.tpl');
}
public function init(){
$this->display_column_left = false;
$this->display_column_right = false;
$this->page_name = 'Configurateur';
parent::init();
$this->setTemplate('formulaire.tpl');
}
}
Thanks in advance for your help !
EDIT :
Ok sorry for the question. It just took me 2 minutes to figure it out after posting the question. I only needed to change:
$this->display(__FILE__,'recapitulatif.tpl');
by :
$this->setTemplate('recapitulatif.tpl');
And now it works. Sorry for the inconvenience !

Use of SPStatefulLongOperation

Can someone give me an example of the use of SPStatefulLongOperation? It's very poorly documented.
Here's an example of code I've just used. It applies a ThmxTheme (selectedTheme) to all SPWebs in an SPSite (site).
SPStatefulLongOperation.Begin(
"Applying theme to sites.",
"<span id='trailingSpan'></span>",
(op) =>
{
op.Run((opState) =>
{
for (int i = 0; i < site.AllWebs.Count; i++)
{
// Update status.
opState.Status = String.Format(
"<script type='text/javascript'>document.all.item('trailingSpan').innerText = '{0} ({1} of {2})';</script>",
site.AllWebs[i].Title,
i + 1,
site.AllWebs.Count);
// Set the theme.
selectedTheme.ApplyTo(site.AllWebs[i], true);
}
});
op.End(System.Web.HttpContext.Current.Request.UrlReferrer.ToString());
});
Note that the current value of opState.State is appended to the client's HTML (via HttpContext.Current.Response.Write and .Flush) every second. Thus you don't want to send any status message directly; you want to send some JavaScript that will update an existing status element on the page. (Here, the trailingSpan element.)