Browse Source

Sessão 12

master
eduveks 5 years ago
parent
commit
c3866b04d3
10 changed files with 236 additions and 3 deletions
  1. BIN
      dbs/social_ma.mv.db
  2. +139
    -0
      public/scripts/main.js
  3. +1
    -1
      public/scripts/main.js.map
  4. +18
    -0
      server/services/info.get.js
  5. +2
    -0
      server/services/info.options.js
  6. +2
    -0
      server/templates/dashboard.html
  7. +23
    -0
      ui/src/containers/Dashboard2Container/index.jsx
  8. +8
    -0
      ui/src/containers/Dashboard2Container/index.less
  9. +23
    -0
      ui/src/index.jsx
  10. +20
    -2
      website/src/pages/Main/index.js

BIN
dbs/social_ma.mv.db View File


+ 139
- 0
public/scripts/main.js View File

@ -173057,6 +173057,24 @@ function copy(text, options) {
module.exports = copy; module.exports = copy;
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js?!./node_modules/less-loader/dist/cjs.js?!./src/containers/Dashboard2Container/index.less":
/*!********************************************************************************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/less-loader/dist/cjs.js??ref--6-2!./src/containers/Dashboard2Container/index.less ***!
\********************************************************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// Imports
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js");
exports = ___CSS_LOADER_API_IMPORT___(true);
// Module
exports.push([module.i, ".my-dashboard {\n width: 100%;\n}\n.my-dashboard__button {\n padding: 80px;\n text-align: center;\n}\n", "",{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACE,WAAW;AACb;AACA;EACE,aAAa;EACb,kBAAkB;AACpB","file":"index.less","sourcesContent":[".my-dashboard {\n width: 100%;\n}\n.my-dashboard__button {\n padding: 80px;\n text-align: center;\n}\n"]}]);
// Exports
module.exports = exports;
/***/ }), /***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js?!./node_modules/less-loader/dist/cjs.js?!./src/containers/DashboardContainer/index.less": /***/ "./node_modules/css-loader/dist/cjs.js?!./node_modules/less-loader/dist/cjs.js?!./src/containers/DashboardContainer/index.less":
@ -240997,6 +241015,109 @@ var TabelaPessoas = function TabelaPessoas() {
/***/ }), /***/ }),
/***/ "./src/containers/Dashboard2Container/index.jsx":
/*!******************************************************!*\
!*** ./src/containers/Dashboard2Container/index.jsx ***!
\******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Dashboard2Container; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var antd_lib_tabs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/tabs */ "./node_modules/antd/lib/tabs/index.js");
/* harmony import */ var antd_lib_tabs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(antd_lib_tabs__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index.less */ "./src/containers/Dashboard2Container/index.less");
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_index_less__WEBPACK_IMPORTED_MODULE_2__);
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var TabPane = antd_lib_tabs__WEBPACK_IMPORTED_MODULE_1___default.a.TabPane;
var Dashboard2Container = /*#__PURE__*/function (_Component) {
_inherits(Dashboard2Container, _Component);
var _super = _createSuper(Dashboard2Container);
function Dashboard2Container(props) {
var _this;
_classCallCheck(this, Dashboard2Container);
_this = _super.call(this, props);
_this.state = {};
return _this;
}
_createClass(Dashboard2Container, [{
key: "render",
value: function render() {
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
className: "my-dashboard"
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("h1", null, "Outro Dashboard"));
}
}]);
return Dashboard2Container;
}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]);
/***/ }),
/***/ "./src/containers/Dashboard2Container/index.less":
/*!*******************************************************!*\
!*** ./src/containers/Dashboard2Container/index.less ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var api = __webpack_require__(/*! ../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js");
var content = __webpack_require__(/*! !../../../node_modules/css-loader/dist/cjs.js??ref--6-1!../../../node_modules/less-loader/dist/cjs.js??ref--6-2!./index.less */ "./node_modules/css-loader/dist/cjs.js?!./node_modules/less-loader/dist/cjs.js?!./src/containers/Dashboard2Container/index.less");
content = content.__esModule ? content.default : content;
if (typeof content === 'string') {
content = [[module.i, content, '']];
}
var options = {};
options.insert = "head";
options.singleton = false;
var update = api(content, options);
module.exports = content.locals || {};
/***/ }),
/***/ "./src/containers/DashboardContainer/index.jsx": /***/ "./src/containers/DashboardContainer/index.jsx":
/*!*****************************************************!*\ /*!*****************************************************!*\
!*** ./src/containers/DashboardContainer/index.jsx ***! !*** ./src/containers/DashboardContainer/index.jsx ***!
@ -241172,11 +241293,29 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js");
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _containers_DashboardContainer_index_jsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./containers/DashboardContainer/index.jsx */ "./src/containers/DashboardContainer/index.jsx"); /* harmony import */ var _containers_DashboardContainer_index_jsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./containers/DashboardContainer/index.jsx */ "./src/containers/DashboardContainer/index.jsx");
/* harmony import */ var _containers_Dashboard2Container_index_jsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./containers/Dashboard2Container/index.jsx */ "./src/containers/Dashboard2Container/index.jsx");
var dashboardDiv = document.getElementById("app-dashboard"); var dashboardDiv = document.getElementById("app-dashboard");
var dashboardContainer = dashboardDiv ? react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_containers_DashboardContainer_index_jsx__WEBPACK_IMPORTED_MODULE_2__["default"], null), dashboardDiv) : false; var dashboardContainer = dashboardDiv ? react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_containers_DashboardContainer_index_jsx__WEBPACK_IMPORTED_MODULE_2__["default"], null), dashboardDiv) : false;
var dashboard2Div = document.getElementById("app-dashboard2");
var dashboard2Container = dashboard2Div ? react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_containers_Dashboard2Container_index_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], null), dashboard2Div) : false;
netuno.addNavigationLoad(function () {
var navigation = $('[netuno-navigation]');
navigation.children().first().after("\n <li>\n <a netuno-navigation-dashboard2 href=\"#app-dashboard2\"><i class=\"fa fa-fw fa-dashboard\"></i> Outro Dashboard</a>\n </li>\n ");
/* const containers = $('[netuno-containers]');
containers.children().first().after(`
<div id="app-dashboard2"></div>
`);
*/
/*
const dashboard2Div = document.getElementById("app-dashboard2-template");
const dashboard2Container = dashboard2Div ? ReactDOM.render(<Dashboard2Container />, dashboard2Div) : false;
*/
});
netuno.addNavigationLoad(function () { netuno.addNavigationLoad(function () {
$('[netuno-navigation]').find('a').on('netuno:click', function (e) { $('[netuno-navigation]').find('a').on('netuno:click', function (e) {
var link = $(e.target); var link = $(e.target);


+ 1
- 1
public/scripts/main.js.map
File diff suppressed because it is too large
View File


+ 18
- 0
server/services/info.get.js View File

@ -0,0 +1,18 @@
_log.info("User ID", _user.id())
const dbPessoa = _db.queryFirst(
`
SELECT pessoa.*, cidade.nome AS cidade
FROM pessoa INNER JOIN cidade ON pessoa.cidade_id = cidade.id
WHERE pessoa.usuario_id = ?
`, _user.id()
)
const data = _val.map()
.set("name", dbPessoa.getString("nome"))
.set("surname", dbPessoa.getString("sobrenome"))
.set("email", dbPessoa.getString("email"))
.set("city", dbPessoa.getString("cidade"))
_out.json(data)

+ 2
- 0
server/services/info.options.js View File

@ -0,0 +1,2 @@
_out.json(_val.map().set("result", true))

+ 2
- 0
server/templates/dashboard.html View File

@ -22,3 +22,5 @@
</div> </div>
<div id="app-dashboard"></div> <div id="app-dashboard"></div>
<div id="app-dashboard2"></div>

+ 23
- 0
ui/src/containers/Dashboard2Container/index.jsx View File

@ -0,0 +1,23 @@
import React, { Component } from "react";
import Tabs from 'antd/lib/tabs';
import "./index.less";
const { TabPane } = Tabs;
export default class Dashboard2Container extends Component {
constructor(props) {
super(props);
this.state = {
};
}
render() {
return (
<div className="my-dashboard">
<h1>Outro Dashboard</h1>
</div>
);
}
}

+ 8
- 0
ui/src/containers/Dashboard2Container/index.less View File

@ -0,0 +1,8 @@
.my-dashboard {
width: 100%;
&__button {
padding: 80px;
text-align: center;
}
}

+ 23
- 0
ui/src/index.jsx View File

@ -1,11 +1,34 @@
import React from "react"; import React from "react";
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
import DashboardContainer from "./containers/DashboardContainer/index.jsx"; import DashboardContainer from "./containers/DashboardContainer/index.jsx";
import Dashboard2Container from "./containers/Dashboard2Container/index.jsx";
const dashboardDiv = document.getElementById("app-dashboard"); const dashboardDiv = document.getElementById("app-dashboard");
const dashboardContainer = dashboardDiv ? ReactDOM.render(<DashboardContainer />, dashboardDiv) : false; const dashboardContainer = dashboardDiv ? ReactDOM.render(<DashboardContainer />, dashboardDiv) : false;
const dashboard2Div = document.getElementById("app-dashboard2");
const dashboard2Container = dashboard2Div ? ReactDOM.render(<Dashboard2Container />, dashboard2Div) : false;
netuno.addNavigationLoad(() => {
const navigation = $('[netuno-navigation]');
navigation.children().first().after(`
<li>
<a netuno-navigation-dashboard2 href="#app-dashboard2"><i class="fa fa-fw fa-dashboard"></i> Outro Dashboard</a>
</li>
`);
/* const containers = $('[netuno-containers]');
containers.children().first().after(`
<div id="app-dashboard2"></div>
`);
*/
/*
const dashboard2Div = document.getElementById("app-dashboard2-template");
const dashboard2Container = dashboard2Div ? ReactDOM.render(<Dashboard2Container />, dashboard2Div) : false;
*/
});
netuno.addNavigationLoad(() => { netuno.addNavigationLoad(() => {
$('[netuno-navigation]').find('a').on('netuno:click', (e)=> { $('[netuno-navigation]').find('a').on('netuno:click', (e)=> {
const link = $(e.target); const link = $(e.target);


+ 20
- 2
website/src/pages/Main/index.js View File

@ -4,15 +4,33 @@ import { Redirect } from "react-router-dom";
import _auth from '@netuno/auth-client'; import _auth from '@netuno/auth-client';
import _service from '@netuno/service-client';
import Core from "../../Core"; import Core from "../../Core";
import { Button } from 'antd';
import { Button, notification } from 'antd';
export default ()=> { export default ()=> {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [data, setData] = useState(null);
if (!_auth.isLogged()) { if (!_auth.isLogged()) {
return <Redirect to="/login" />; return <Redirect to="/login" />;
} }
useEffect(()=> {
_service({
url: "info",
success: (response) => {
setData(response.json);
},
fail: (e) => {
console.log("Service Error", e);
notification["error"]({
message: 'Informações',
description: 'Não foi possível carregar a informação.',
});
}
});
}, []);
const onLogout = ()=> { const onLogout = ()=> {
_auth.logout(); _auth.logout();
setLoading(true); setLoading(true);
@ -21,7 +39,7 @@ export default ()=> {
} }
return ( return (
<div> <div>
<h1>Olá! Logado...</h1>
<h1>Olá! { data && <h3>{data.name}</h3> }...</h1>
<Button onClick={onLogout} loading={loading}>Sair</Button> <Button onClick={onLogout} loading={loading}>Sair</Button>
</div> </div>
); );


Loading…
Cancel
Save