You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/installguide/primate.rst
+6-159Lines changed: 6 additions & 159 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,8 +138,7 @@ Example nginx config:
138
138
139
139
Basic Customization in CloudStack Primate
140
140
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
141
-
Users can now customize the CloudStack's user interface by means of a configutaion file - config.json found at
142
-
https://github.com/apache/cloudstack-primate/tree/master/public. The public/config.json file (or correspondingly, the dist/config.json file, after build, which is available at /usr/share/cloudstack-management/webapp/primate/) can be used to modify the theme, logos, etc. to align to one's requirement.
141
+
Users can now customize the CloudStack's user interface by means of a configutaion file at /usr/share/cloudstack-management/webapp/primate/config.json can be used to modify the theme, logos, etc. to align to one's requirement.
143
142
144
143
To change the logo,login banner,error page icon, etc. the following details can be editted in config.json:
145
144
@@ -216,166 +215,14 @@ Some assorted primary theme colours:
216
215
- Green: #52C41A
217
216
- Purple: #722ED1
218
217
219
-
Also, to add other properties, we can use the theme.config.js file which based on the Ant Design Vue Less variable. Refer: https://www.antdv.com/docs/vue/customize-theme/#Ant-Design-Vue-Less-variables
220
-
These properties can then be modified or set in the config.json file. On refresh Vue's modify variable enables the run-time modification of Less variables. When called with new values, the Less file is recompiled without reloading.
221
-
222
-
CloudStack Primate also supports adding custom plugins, which can be defined in config.json. These plugins are then implemented as iframes in Primate.
223
-
224
-
.. parsed-literal ::
225
-
226
-
"plugins": [
227
-
{
228
-
"name": "ExamplePlugin",
229
-
"icon": "appstore",
230
-
"path": "example.html"
231
-
}
232
-
]
233
-
234
218
Advanced Customization
235
219
~~~~~~~~~~~~~~~~~~~~~~
236
220
237
-
CloudStack Primate has been developed in a way that makes it easy for one to add new features/components with minimal effort as most of the complexity has been abstracted by means of auto-generation of basic forms.
238
-
239
-
Defining a new Section
240
-
~~~~~~~~~~~~~~~~~~~~~~
241
-
242
-
A new section may be added by creating a javascript file in **src/config/section/** of the root directory. Correspondingly, this newly added configuration file (e.g., newSection.js), defining the section, needs to be imported in the **src/config/router.js** configuration file and rules need to be added to the *asyncRouterMap*, so as to render the matched component for the given path
243
-
244
-
.. code-block :: javascript
245
-
246
-
import newSection from '@/config/section/newSection'
247
-
248
-
[ ... snipped ... ]
249
-
250
-
generateRouterMap(newSection),
251
-
252
-
An existing or new section config/js file must export the following parameters:
253
-
254
-
- name: unique path in URL
255
-
- title: the name to be displayed in navigation and breadcrumb
256
-
- icon: the icon to be displayed, from AntD's icon set https://vue.ant.design/components/icon/
257
-
- children: (optional) array of resources sub-navigation under the parent group
258
-
- permission: when children are not defined, the array of API to check against allowed auto-discovered APIs
259
-
- columns: when children is not defined, list of column keys
260
-
- component: when children is not defined, the custom component for rendering the route view
261
-
262
-
For example, see src/config/section/compute.js and src/config/section/project.js.
263
-
264
-
The children should have:
265
-
266
-
- name: unique path in the URL
267
-
- title: the name to be displayed in navigation and breadcrumb
268
-
- icon: the icon to be displayed, from AntD's icon set https://vue.ant.design/components/icon/
269
-
- permission: the array of API to check against auto-discovered APIs
270
-
- columns: list of column keys for list view rendering
271
-
- details: list of keys for detail list rendering for a resource
272
-
- tabs: array of custom components that will get rendered as tabs in the resource view
273
-
- component: the custom component for rendering the route view default list view (table)
274
-
- actions: arrays of actions/buttons
275
-
- related: a list of associated entitiy types that can be listed via passing the current resource's id as a parameter in their respective list api
276
-
277
-
Action API
278
-
~~~~~~~~~~
279
-
280
-
If a user wants to add an action button to perform as the name implies a specific action, without having to implement a custom component, one may use the Action API in the correspondins section's javascript file. The sections are defined under src/config/section path of the root directory.
281
-
The actions defined for a child shows up as a group of buttons on the default autogen view (that shows tables, actions etc.). Each action item should define:
282
-
283
-
284
-
- api: The CloudStack API for the action
285
-
- icon: the icon to be displayed from AntD's icon set https://vue.ant.design/components/icon/
286
-
- label: The action button's name
287
-
- message: The action button's confirmation message
288
-
- docHelp: Allows to provide a link to a document to provide details on the action
289
-
- listView: (boolean) whether to show the action button in list view (table)
290
-
- dataView: (boolean) whether to show the action button in resource/data view
291
-
- groupAction: Whether the button supports groupable actions when multiple items are selected in the table
292
-
- args: list of API arguments to render/show on auto-generated action form
293
-
- mapping: The relation of an arg to an api (from which it's id is used as a select-option) or a given hardcoded list of select-options
294
-
- show: function that takes in a records and returns a boolean to control if the action button needs to be shown or hidden
295
-
- popup: (boolean) when true, displays any custom component in a popup modal than in its separate route view
296
-
- component: the custom component to render the action (in a separate route view)
However, if one's requirement is to perform further operations as part of their form, then a custom Vue component must be defined under the src/views/<component> folder of the root directory and the defined component must them be imported in the corresponding section's javascript file. Examples of how to create such views are available in the cloudstack-primate repository
After having, defined a section and the actions that can be performed in the particular section; on navigating to the section, we can have a list of resources available, for example,On navigating to **Compute > Instances** section, we see a list of all the VM instances (each instance referred to as a resource).
335
-
The columns that should be made available while displaying the list of resources can be defined in the section's configuration file under the columns attribute (as mentioned above). **columns** maybe defined as an array or a function in case we need to selectively (i.e., based on certain conditions) restrict the view of certain columns.
// columns can also be defined as a function, so as to conditionally restrict view of certain columns
345
-
columns: () => {
346
-
var fields = ['name', 'hypervisor', 'ostypename']
347
-
if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) {
348
-
fields.push('account')
349
-
}
350
-
...
351
-
}
352
-
353
-
Resource Detail View Customization
354
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
355
-
From the List View of the resources, on can navigate to the individual resource's detail view, which in CloudStack Primate we refer to as the *Resource View* by click on the specific resource.
356
-
The Resource View has 2 sections:
357
-
- InfoCard to the left that has basic/ minimal details of that resource
358
-
- and the tabs to the right that can be either defined as custom components or if we just want basic details of the resource to be displayed we may use the *DetailsTab* to render the required details of the resource. You can control what needs to be displayed by spcifying their names in the *details* array.
359
-
The names specified in the details array should correspond to the api parameters
0 commit comments