From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 165271FF195
	for <inbox@lore.proxmox.com>; Fri,  7 Mar 2025 16:57:50 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id A7AF81F644;
	Fri,  7 Mar 2025 16:57:42 +0100 (CET)
Date: Fri, 7 Mar 2025 16:57:08 +0100
From: Gabriel Goller <g.goller@proxmox.com>
To: Stefan Hanreich <s.hanreich@proxmox.com>
Message-ID: <2skxqoknzkfws3tuuy3zumi64nbpqedltbb7ga3ulwc6h6symu@bsamd67yuuim>
Mail-Followup-To: Stefan Hanreich <s.hanreich@proxmox.com>, 
 pve-devel@lists.proxmox.com
References: <20250214133951.344500-1-g.goller@proxmox.com>
 <20250214133951.344500-10-g.goller@proxmox.com>
 <cf2dc325-2835-43c9-9b12-6f0afebc2e79@proxmox.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <cf2dc325-2835-43c9-9b12-6f0afebc2e79@proxmox.com>
User-Agent: NeoMutt/20241002-35-39f9a6
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.028 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pve-devel] [PATCH pve-manager 09/11] sdn: add Fabrics view
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Cc: pve-devel@lists.proxmox.com
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

>> +	    Proxmox.Utils.API2Request({
>> +		url: `/cluster/sdn/fabrics/`,
>> +		method: 'GET',
>> +		success: function(response, opts) {
>> +		    let ospf = Object.entries(response.result.data.ospf);
>> +		    let openfabric = Object.entries(response.result.data.openfabric);
>> +
>> +		    // add some metadata so we can merge the objects later and still know the protocol/type
>> +		    ospf = ospf.map(x => {
>> +			if (x["1"].fabric) {
>> +			    return Object.assign(x["1"].fabric, { _protocol: "ospf", _type: "fabric", name: x["0"] });
>> +			} else if (x["1"].node) {
>> +			    let id = x["0"].split("_");
>
>I think we already talked about this, but I don't really remember the
>outcome. Can we return this already from the API so we don't have to
>parse it in the frontend?

Hmm I can't remember. If we want to do this api-side we need to create
new api types, because currently we just return the SectionConfig types.
I don't think there is any way to "parse" (i.e. split at the '_') the
key and throw it into a property.

>> +			    return Object.assign(x["1"].node,
>> +				{
>> +				    _protocol: "ospf",
>> +				    _type: "node",
>> +				    node: id[1],
>> +				    fabric: id[0],
>> +				},
>> +			    );
>> +			} else {
>> +			    return x;
>> +			}
>> +		    });


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel