Opened 13 years ago

Closed 13 years ago

#1330 closed enhancement (fixed)

Add support function in JavaScript for parsing AJAX responses

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: major Milestone: BASE 2.13
Component: web Version:
Keywords: Cc:

Description

The GenePattern integration is going to use a lot of Ajax calls to get information. Ajax is also used more and more in the BASE web client. I think we should create some support functions in JavaScript? for parsing responses. A typical response from the subdirectory lazy loading in the file manager:

begin
id:4
name:images
path:/template/images
removed:0
auto-compress:0
home:0
end
begin
id:6
name:projects
path:/template/projects
removed:0
auto-compress:0
home:0
end
begin
id:5
name:raw data
path:/template/raw data
removed:0
auto-compress:1
home:0
end

Information for each subdirectory is between begin/end and each line contains a single piece of tagged information. I think we should extend this a bit further:

  • The first line is a status, eg: status:ok or status:error
  • Then follows one or more records.
  • Each line starts with a named property followed by : and the value.
  • A named property may be repeated in which case the property is converted into an array
  • An empty line ends the current record

Change History (5)

comment:1 Changed 13 years ago by Nicklas Nordborg

Owner: changed from everyone to Nicklas Nordborg
Status: newassigned

comment:2 Changed 13 years ago by Nicklas Nordborg

(In [4964]) References #1330: Add support function in JavaScript? for parsing AJAX responses

The basics is now working and implemented in the file manager when listing subdirectories. May need some more features when more Ajax functionality is developed.

comment:3 Changed 13 years ago by Nicklas Nordborg

(In [4966]) References #1330: Add support function in JavaScript? for parsing AJAX responses

Fixes a problem with newline escaping.

comment:4 Changed 13 years ago by Nicklas Nordborg

(In [4967]) References #1330: Add support function in JavaScript? for parsing AJAX responses

The output from println() depends on the platform the server runs on. Use print("\n") instead to get deterministic output that can be parsed by javascript without fuzz.

comment:5 Changed 13 years ago by Nicklas Nordborg

Resolution: fixed
Status: assignedclosed

Seems to work well also for the GenePattern ajax calls.

Note: See TracTickets for help on using tickets.