+ {/* TODO: Rendere dinamico (permetti a chi chiama il componente di
+ scegliere i valori da visualizzare */}
102550
@@ -30,6 +33,7 @@ export default class DataTable extends Component {
;
+ }
+}
diff --git a/resources/js/Components/Grid/index.js b/resources/js/Components/Grid/index.js
new file mode 100644
index 000000000..0ddb7d727
--- /dev/null
+++ b/resources/js/Components/Grid/index.js
@@ -0,0 +1,4 @@
+export { default as Cell } from './Cell.jsx';
+export { default as LayoutGrid } from './LayoutGrid.jsx';
+export { default as Row } from './Row.jsx';
+
diff --git a/resources/js/Components/Mdi.js b/resources/js/Components/Mdi.js
deleted file mode 100644
index 2fde80ca2..000000000
--- a/resources/js/Components/Mdi.js
+++ /dev/null
@@ -1,14 +0,0 @@
-import Component from './Component';
-
-export default class Mdi extends Component {
- view(vnode) {
- return ;
- /*
- Quando MWC supporterà pienamente le icone SVG potremo
- import * as mdi from '@mdi/js';
- import {camelCase} from 'lodash/string';
- return ; */
- }
-}
diff --git a/resources/js/Components/Mdi.jsx b/resources/js/Components/Mdi.jsx
new file mode 100644
index 000000000..85b77effd
--- /dev/null
+++ b/resources/js/Components/Mdi.jsx
@@ -0,0 +1,19 @@
+import Component from './Component';
+
+export default class Mdi extends Component {
+ view(vnode) {
+ this.attrs.addClassNames('mdi', `mdi-${vnode.attrs.icon}`);
+ return ;
+ }
+}
+
+/*
+ Quando MWC supporterà pienamente le icone SVG potremo fare così:
+ import * as mdi from '@mdi/js';
+ import {camelCase} from 'lodash/string';
+
+ return ;
+*/
diff --git a/resources/js/Components/Page.js b/resources/js/Components/Page.jsx
similarity index 68%
rename from resources/js/Components/Page.js
rename to resources/js/Components/Page.jsx
index 33948ee27..3c0b003a8 100644
--- a/resources/js/Components/Page.js
+++ b/resources/js/Components/Page.jsx
@@ -1,5 +1,6 @@
-import * as Mithril from 'mithril';
-import * as render from 'mithril-node-render';
+import {Vnode} from 'mithril';
+import {sync as render} from 'mithril-node-render';
+
import Component from './Component';
/**
@@ -21,21 +22,22 @@ export default class Page extends Component {
/**
* Ritorna una traduzione
*
- * @param {string|Mithril.Vnode} key Stringa di cui prelevare la traduzione
+ * @param {string|Vnode} key Stringa di cui prelevare la traduzione
* @param {Object|boolean} replace Eventuali parametri da rimpiazzare.
* Se il parametro è "true" (valore booleano), verrà ritornato il valore come stringa
* (stesso funzionamento del parametro dedicato (sotto ↓))
* @param {boolean} returnAsString Se impostato a "true" vien ritornata una stringa invece di
* un Vnode di Mithril
- * @returns {Mithril.Vnode}
+ *
+ * @returns {Vnode}
*
* @protected
*/
__(
- key: string | Mithril.Vnode,
+ key: string | Vnode,
replace: Object | boolean = {},
returnAsString: boolean = false
- ): Mithril.Vnode {
+ ): Vnode {
let translation = (this.page.translations && this.page.translations[key])
? this.page.translations[key] : key;
@@ -44,11 +46,11 @@ export default class Page extends Component {
return translation;
}
- Object.keys(replace).forEach(async (k: string) => {
- // "'attrs' in replace[k]" controlla se replace[k] è un vnode di Mithril
- translation = translation.replace(`:${k}`, ((typeof replace[k] === 'object' && 'attrs' in replace[k]) ? render.sync(replace[k]) : replace[k]));
- });
+ for (const k of Object.keys(replace)) {
+ // `'attrs' in replace[k]` controlla se replace[k] è un vnode di Mithril
+ translation = translation.replace(`:${k}`, ((typeof replace[k] === 'object' && 'attrs' in replace[k]) ? render(replace[k]) : replace[k]));
+ }
- return returnAsString ? translation : Mithril.m.trust(translation);
+ return returnAsString ? translation : window.m.trust(translation);
}
}
diff --git a/resources/js/Components/ListPage.js b/resources/js/Components/Pages/ListPage.jsx
similarity index 54%
rename from resources/js/Components/ListPage.js
rename to resources/js/Components/Pages/ListPage.jsx
index 1fca6bf9b..01e064400 100644
--- a/resources/js/Components/ListPage.js
+++ b/resources/js/Components/Pages/ListPage.jsx
@@ -1,11 +1,11 @@
-import Page from './Page';
-import DataTable from './DataTable/DataTable';
-import TableHeadCell from './DataTable/TableHeadCell';
-import TableHead from './DataTable/TableHead';
-import TableHeadRow from './DataTable/TableHeadRow';
-import TableBody from './DataTable/TableBody';
-import TableRow from './DataTable/TableRow';
-import TableCell from './DataTable/TableCell';
+import DataTable from '../DataTable/DataTable';
+import TableBody from '../DataTable/TableBody';
+import TableCell from '../DataTable/TableCell';
+import TableHead from '../DataTable/TableHead';
+import TableHeadCell from '../DataTable/TableHeadCell';
+import TableHeadRow from '../DataTable/TableHeadRow';
+import TableRow from '../DataTable/TableRow';
+import Page from '../Page';
/**
* @abstract
@@ -21,16 +21,16 @@ export default class ListPage extends Page {
view(vnode) {
const columns = this.columns.map(
- (column, i) => (
-
+ (column, index) => (
+
{column}
)
);
- const rows = this.rows.length ? this.rows.map((row, i) => (
-
- {row.map((cell, index) => {cell})}
+ const rows = this.rows.length > 0 ? this.rows.map((row, index) => (
+
+ {row.map((cell, index_) => {cell})}
)) : {this.__('Non sono presenti dati')};
diff --git a/resources/js/Components/index.js b/resources/js/Components/index.js
new file mode 100644
index 000000000..4f29370b0
--- /dev/null
+++ b/resources/js/Components/index.js
@@ -0,0 +1,8 @@
+export * from './Card';
+export { default as Component } from './Component.jsx';
+export * from './DataTable';
+export { extend, override } from './extend';
+export * from './Grid';
+export { default as ListPage } from './Pages/ListPage.jsx';
+export { default as Mdi } from './Mdi.jsx';
+export { default as Page } from './Page.jsx';
diff --git a/resources/js/Views/SetupPage.js b/resources/js/Views/SetupPage.jsx
similarity index 78%
rename from resources/js/Views/SetupPage.js
rename to resources/js/Views/SetupPage.jsx
index 42e7470b8..ec9d84e6f 100644
--- a/resources/js/Views/SetupPage.js
+++ b/resources/js/Views/SetupPage.jsx
@@ -6,30 +6,32 @@ import '@material/mwc-list/mwc-list-item';
import '@material/mwc-select';
import '@material/mwc-textarea';
import '@material/mwc-textfield';
+
+import collect from 'collect.js';
import LocaleCode from 'locale-code';
import Mithril from 'mithril';
-import Page from '../Components/Page';
-import LayoutGrid from '../Components/Grid/LayoutGrid';
-import Row from '../Components/Grid/Row';
-import Cell from '../Components/Grid/Cell';
-import Mdi from '../Components/Mdi';
+import logoUrl from '@/static/images/logo_completo.png';
+
import Card from '../Components/Card/Card';
import Content from '../Components/Card/Content';
+import Cell from '../Components/Grid/Cell';
+import LayoutGrid from '../Components/Grid/LayoutGrid';
+import Row from '../Components/Grid/Row';
+import Mdi from '../Components/Mdi';
+import Page from '../Components/Page';
export default class SetupPage extends Page {
- // eslint-disable-next-line no-unused-vars
view(vnode) {
- const listItems: array[Mithril.Vnode] = [];
+ const listItems: Array[Mithril.Vnode] = [];
- // noinspection JSUnresolvedVariable
- this.page.props.languages.forEach((lang) => {
- const prop = {
+ for (const lang of this.page.props.languages) {
+ const attributes = {
selected: this.page.props.locale === lang
};
const langCode = lang.replace('_', '-');
listItems.push(
-
+
{LocaleCode.getLanguageNativeName(langCode)}
);
- });
+ }
+
+ const examplesTexts = collect();
+ for (const example of ['localhost', 'root', 'mysql', 'openstamanager']) {
+ examplesTexts.put(example, this.__('Esempio: :example', {example}, true));
+ }
return (
<>
-
+
-
+
{this.__('Benvenuto in :name!', {name: {this.__('OpenSTAManager')}})}
{this.__('Puoi procedere alla configurazione tecnica del software attraverso i '
+ 'parametri seguenti, che potranno essere corretti secondo necessità tramite il file .env.')}
- {this.__("Se necessiti supporto puoi contattarci tramite l':contact_link o tramite il nostro :forum_link.", {
- contact_link: {this.__('assistenza ufficiale')},
- forum_link: {this.__('forum')}
+ {this.__("Se necessiti supporto puoi contattarci tramite l':contactLink o tramite il nostro :forumLink.", {
+ // eslint-disable-next-line no-secrets/no-secrets
+ contactLink: {this.__('assistenza ufficiale')},
+ forumLink: {this.__('forum')}
})}