3 | | = New web interface |
4 | | |
5 | | In addition to the console UIs, we also maintain a browser based (remote, via HTTP) interface to the tool, which provides an even more convenient way for code grokking. The main features of the web interface are: |
6 | | |
7 | | * Running and exploring semantic queries (both normal and context-sensitive queries) |
8 | | * Query construct assistant (auto-complete) |
9 | | * Persistent queries |
10 | | * Management of (possibly multiple) running queries |
11 | | * Database operations |
12 | | * Ability to mark files with error forms |
13 | | * Dependency examinations |
14 | | |
15 | | ''Note that !JavaScript must be enabled in the browser to be able to use this interface.'' |
16 | | |
17 | | == Installation |
18 | | Actually, this interface is only a limited prototype, thus it has some extra restrictions, which are related to the used web browser. Due to the usage of web sockets, neither Internet Explorer nor Firefox are not supported. We only support Google Chrome and Safari. |
19 | | |
20 | | === Yaws === |
21 | | The web based UI is built upon the [http://yaws.hyber.org/ Yaws] web server. To be able to start this interface you need a Yaws web server installed. Installation help: http://yaws.hyber.org/yaws.pdf (see Chapter 2). |
22 | | |
23 | | * Required version: 1.95 |
24 | | |
25 | | If you prefer using a different version of Yaws, please, use [wiki:WebInterface the old web based interface] of the tool. |
26 | | |
27 | | '''If Erlang/OTP-R16B01 or a newer version is used''', then none of the Yaws versions will be compiled from source. The problem is that every Erlang source of Yaws is compiled with the {{{-Werror}}} flag which causes build error when used with at least Erlang/OTP-R16B01 to compile Yaws. |
28 | | |
29 | | To fix this error, you should use this modified Makefile. Put [attachment:Makefile:wiki:WebInterface this Makefile] under the {{{src}}} directory of the downloaded sources of Yaws, then execute {{{make clean}}}. After the execution, the standard build procedure should be followed which is shown in LocalInstallLinux page. |
30 | | |
31 | | If Windows is used, then other opportunity exists. Use the installer binaries of different Yaws versions (Yaws-1.92 - Yaws-1.96) instead of compiling them from source. |
32 | | |
33 | | For a step-by-step installation tutorial, which is including the installation guide of Yaws, please see LocalInstallLinux. |
34 | | |
35 | | == Starting up |
36 | | |
37 | | We can start the server either with the {{{referl}}} script using the {{{-web2}}} option, or from a running !RefactorErl shell. Both cases provide a default configuration: server name {{{localhost}}}, port {{{8001}}}, and address {{{127.0.0.1.}}}, which can be overridden. |
38 | | |
39 | | Possible options: |
40 | | |
41 | | * {{{yaws_path YPATH}}} |
42 | | |
43 | | The absolute location of your Yaws ebin directory. |
44 | | |
45 | | * {{{yaws_listen YLISTEN}}} |
46 | | |
47 | | Valid IP address, which Yaws will listen to. |
48 | | |
49 | | * {{{yaws_name YNAME}}} |
50 | | |
51 | | Valid domain name, which Yaws will be bound to. |
52 | | |
53 | | * {{{yaws_port YPORT}}} |
54 | | |
55 | | Valid port number, which Yaws will be bound to. |
56 | | |
57 | | * {{{browser_root BROOT}}} |
58 | | |
59 | | The web interface allows database operations. The root directory for those operations can be set with this parameter. |
60 | | |
61 | | * {{{images_dir IDIR}}} |
62 | | |
63 | | Path of the directory where the generated images (visualisation of dependency examinations) will be placed. |
64 | | |
65 | | === Startup: referl script |
66 | | |
67 | | You can pass any of the above options via command-line arguments (note that {{{-web2}}} is mandatory). |
68 | | Example: |
69 | | {{{ |
70 | | bin/referl -web2 |
71 | | -yaws_path /Users/V/yaws-1.95/ebin |
72 | | -yaws_listen 127.0.0.1 |
73 | | -yaws_port 8000 |
74 | | -yaws_name localhost |
75 | | -browser_root /Users/V/erlang |
76 | | -images_dir /Users/V/graph_images |
77 | | }}} |
78 | | |
79 | | === Startup: !RefactorErl shell |
80 | | |
81 | | We have two functions for starting the interface : {{{ri:start_web2/0}}} and {{{ri:start_web2/1}}}. Without passing any parameters the web server starts up with the default configuration. The 1-arity function allows the interface to be configured using an [http://www.erlang.org/doc/man/proplists.html Erlang proplist]. Example: |
82 | | {{{ |
83 | | #!erlang |
84 | | |
85 | | ri:start_web2([ |
86 | | {yaws_path,"/Users/V/yaws-1.95/ebin"}, |
87 | | {yaws_listen,"127.0.0.1"}, |
88 | | {yaws_name, localhost}, |
89 | | {yaws_port,"8000"}, |
90 | | {browser_root,"/Users/V/erlang"}, |
91 | | {images_dir,"/Users/V/graph_images"}]). |
92 | | }}} |
93 | | |
94 | | |
95 | | == Shutting down |
96 | | |
97 | | You are advised to always log out before shutting down the web server, because the log-out process deletes temporary, dynamically generated components of web pages. If the server has been started from the !RefactorErl shell, then {{{ri:stop_web2()}}} should be called in order to shut down the service. |
98 | | |
99 | | |
100 | | == Logging in |
101 | | |
102 | | In your favourite browser, navigate to the server address defined by the configuration (the default is {{{http://localhost:8001}}}) after the web server has been successfully started. Services are allowed only to authorized people, so first you have to log in with a username. The browser will be redirected to the ''queries'' page. |
103 | | |
104 | | == Global notifications |
105 | | |
106 | | When someone starts/finishes a modification of the database (e.g. adding files), a notification will appear stating what process has been started/finished. |
107 | | During any modification process most functions on the web interface will not be available. This restriction is global for the whole system. |
108 | | For further information, see: [wiki:ConfigurableJobServer Configurable Jobserver] |
109 | | |
110 | | == Database operations |
111 | | |
112 | | This service is available under the "Database" tab. The file browser panel is located at the left side of the page. You can either browse files which are located on the server ("Browse server"), or which had been loaded into the database ("Browse loaded files"). You can switch between these two options by clicking the button in the top right corner of the file browser box. |
113 | | |
114 | | === Browsing files on the server |
115 | | |
116 | | The root directory of the browser is an optional configuration parameter. Possible values are: |
117 | | |
118 | | * If the {{{browser_root}}} parameter is set during start up, the given value is the root directory. |
119 | | * If the {{{browser_root}}} parameter is not set during start up |
120 | | * If the database had contained files before start up, the root elements are the directories of these files. |
121 | | * If the database had not contained files before start up, then !RefactorErl’s lib directory will be the root. |
122 | | |
123 | | In this mode, directories can be listed, the contents of files can be shown, and a selected directory or file can be added to the database. The selected directory or file is highlighted by a blue background. Database operations are indicated by a progress bar. |
124 | | |
125 | | Searching is possible in both file system files, and loaded files. |
126 | | |
127 | | === Browsing loaded files |
128 | | |
129 | | In this mode, directories' and files' contents can be listed, a selected file or directory can be reloaded to the database, dropped from the database, or can be pre-generated for the source code viewer. Status messages are displayed during the reloading/dropping/generating process, and also after the process has finished. |
130 | | The file browser displays the last directory that contains all the loaded files. |
131 | | Under the file browser box, there is a separate box for the function quicklist. In this box, the function definitions of the displayed file are listed if the file is added to the database. You can jump to the chosen function in the file by clicking on. |
132 | | If file is not displayed correctly, you can try to "repair" it by clicking the Refresh button in the upper right corner of the function quicklist window. |
133 | | |
134 | | ''Dropping a file from the database does not imply removing it from the file system.'' |
135 | | |
136 | | == Running semantic queries |
137 | | |
138 | | See [wiki:Web2/RunningSemanticQueries Running semantic queries]. |
139 | | |
140 | | == Errors |
141 | | |
142 | | This service is available under the "Errors" tab. |
143 | | |
144 | | If the database contains file(s) with error form(s), the list of errors will be displayed in a table. Each row in the table shows an error. Clicking the file name shows the file and highlights the position of the error. |
145 | | |
146 | | If the database does not contain any files with error forms, a "No error" message is displayed. |
147 | | |
148 | | == Dependency examination |
149 | | |
150 | | See [wiki:Web2/DependencyExaminations Dependency examinations]. |
151 | | {{{#!comment |
152 | | == Code duplicates |
153 | | |
154 | | See [wiki:WebInterface/CodeDuplicates Code duplicates]. |
155 | | }}} |
156 | | |
157 | | == Logging out |
158 | | |
159 | | You can log out by clicking the "Log out {{{username}}}" button. During the logout process the interface clears the users' session, deletes the dynamically generated images belonging to the user, and redirects the browser to the login page. The interface does not delete the queries executed by the user, nor their results, and also keeps the state of the database. |
160 | | |
161 | | {{{#!comment |