Skip to content

Commit

Permalink
Merge pull request #182 from EyeSeeTea/development-who
Browse files Browse the repository at this point in the history
Release 0.5.0
  • Loading branch information
adrianq authored Oct 18, 2019
2 parents 851c48d + e70496e commit 7b7e210
Show file tree
Hide file tree
Showing 40 changed files with 1,764 additions and 267 deletions.
28 changes: 5 additions & 23 deletions cypress/integration/landing-page.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ context("Landing page", () => {
.should("be.visible");

cy.contains("Instance Configuration");
cy.contains("Organisation Units");
cy.contains("Data Elements");
cy.contains("Indicators");
cy.contains("Validation Rules");
cy.contains("Synchronization Rules");
cy.contains("Metadata");
cy.contains("Metadata Synchronization Rules");
cy.contains("Synchronization History");
});

Expand All @@ -25,24 +22,9 @@ context("Landing page", () => {
cy.get(dataTest("page-header-title")).contains("Instance Configuration");
});

it("enters the Organisation Units Synchronization page", function() {
cy.get(dataTest("page-sync/organisationUnits")).click();
cy.get(dataTest("page-header-title")).contains("Organisation Units Synchronization");
});

it("enter the Data Elements Synchronization page", function() {
cy.get(dataTest("page-sync/dataElements")).click();
cy.get(dataTest("page-header-title")).contains("Data Elements Synchronization");
});

it("enter the Indicators Synchronization page", function() {
cy.get(dataTest("page-sync/indicators")).click();
cy.get(dataTest("page-header-title")).contains("Indicators Synchronization");
});

it("enter the Validation Rules Synchronization page", function() {
cy.get(dataTest("page-sync/validationRules")).click();
cy.get(dataTest("page-header-title")).contains("Validation Rules Synchronization");
it("enters the Metadata Synchronization page", function() {
cy.get(dataTest("page-sync/metadata")).click();
cy.get(dataTest("page-header-title")).contains("Metadata Synchronization");
});

it("enter the Synchronization Rules page", function() {
Expand Down
93 changes: 66 additions & 27 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2019-09-17T10:45:09.309Z\n"
"PO-Revision-Date: 2019-09-17T10:45:09.309Z\n"
"POT-Creation-Date: 2019-10-16T09:02:16.076Z\n"
"PO-Revision-Date: 2019-10-16T09:02:16.076Z\n"

msgid "Metadata Synchronization"
msgstr ""
Expand Down Expand Up @@ -160,19 +160,7 @@ msgstr[1] ""
msgid "Instance Configuration"
msgstr ""

msgid "Organisation Units"
msgstr ""

msgid "Data Elements"
msgstr ""

msgid "Indicators"
msgstr ""

msgid "Validation Rules"
msgstr ""

msgid "Synchronization Rules"
msgid "Metadata Synchronization Rules"
msgstr ""

msgid "Deleted objects"
Expand Down Expand Up @@ -310,6 +298,21 @@ msgstr ""
msgid "Target instances [{{total}}]"
msgstr ""

msgid "Advanced options"
msgstr ""

msgid "Include user information and sharing settings"
msgstr ""

msgid "No"
msgstr ""

msgid "Disable atomic verification"
msgstr ""

msgid "Replace objects in destination instance"
msgstr ""

msgid "Enabled"
msgstr ""

Expand Down Expand Up @@ -378,12 +381,18 @@ msgstr ""
msgid "Toggle scheduling"
msgstr ""

msgid "Sharing settings"
msgstr ""

msgid "Last executed date"
msgstr ""

msgid "Destination Instance"
msgstr ""

msgid "Synchronization Rules"
msgstr ""

msgid "Delete Rules?"
msgstr ""

Expand All @@ -392,6 +401,48 @@ msgid_plural "Are you sure you want to delete {{count}} rules?"
msgstr[0] ""
msgstr[1] ""

msgid "External access"
msgstr ""

msgid "Anyone can view without login"
msgstr ""

msgid "No access"
msgstr ""

msgid "Public access"
msgstr ""

msgid "METADATA"
msgstr ""

msgid "Can edit and view"
msgstr ""

msgid "Can view only"
msgstr ""

msgid "DATA"
msgstr ""

msgid "Can capture and view"
msgstr ""

msgid "Created by"
msgstr ""

msgid "Who has access"
msgstr ""

msgid "Close"
msgstr ""

msgid "Add users and user groups"
msgstr ""

msgid "Enter names"
msgstr ""

msgid "Synchronize Metadata"
msgstr ""

Expand Down Expand Up @@ -434,9 +485,6 @@ msgstr ""
msgid "JSON Response"
msgstr ""

msgid "Data Elements Synchronization"
msgstr ""

msgid "Code"
msgstr ""

Expand All @@ -452,15 +500,6 @@ msgstr ""
msgid "Unknown error with the request"
msgstr ""

msgid "Indicators Synchronization"
msgstr ""

msgid "Organisation Units Synchronization"
msgstr ""

msgid "Validation Rules Synchronization"
msgstr ""

msgid "Retrieving information from remote instances"
msgstr ""

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "metadata-synchronization",
"description": "Advanced metadata synchronization utility",
"version": "0.4.0",
"version": "0.5.0",
"license": "GPL-3.0",
"author": "EyeSeeTea team",
"homepage": ".",
Expand All @@ -26,6 +26,7 @@
"d2": "^31.1.1",
"d2-manifest": "^1.0.0",
"d2-ui-components": "^0.0.25",
"downshift": "^3.3.4",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"enzyme-to-json": "^3.4.0",
Expand Down
5 changes: 4 additions & 1 deletion src/components/app/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Share from "../share/Share";
import Instance from "../../models/instance";
import { muiTheme } from "./themes/dhis2.theme";
import muiThemeLegacy from "./themes/dhis2-legacy.theme";
import { initializeAppRoles } from "../../utils/permissions";
import "./App.css";

const generateClassName = createGenerateClassName({
Expand All @@ -26,7 +27,7 @@ class App extends Component {
appConfig: PropTypes.object.isRequired,
};

componentDidMount() {
async componentDidMount() {
const { d2, appConfig } = this.props;
const appKey = _(this.props.appConfig).get("appKey");

Expand All @@ -41,6 +42,8 @@ class App extends Component {
if (appConfig && appConfig.encryptionKey) {
Instance.setEncryptionKey(appConfig.encryptionKey);
}

await initializeAppRoles(d2.Api.getApi().baseUrl);
}

render() {
Expand Down
41 changes: 12 additions & 29 deletions src/components/app/Root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { Route, Switch } from "react-router-dom";
import LandingPage from "../landing-page/LandingPage";
import InstanceConfigurator from "../instance-list-page/InstancesPage";
import InstanceFormBuilder from "../instance-creation-page/InstanceCreationPage";
import OrganisationUnitPage from "../synchronization-page/OrganisationUnitPage";
import DataElementPage from "../synchronization-page/DataElementPage";
import IndicatorPage from "../synchronization-page/IndicatorPage";
import ValidationRulePage from "../synchronization-page/ValidationRulePage";
import MetadataPage from "../synchronization-page/MetadataPage";
import DeletedObjectsPage from "../synchronization-page/DeletedObjectsPage";
import HistoryPage from "../history-list-page/HistoryPage";
import SyncRulesWizard from "../rules-creation-page/SyncRulesWizard";
Expand All @@ -20,58 +17,44 @@ class Root extends React.Component {
};

render() {
const { d2 } = this.props;

return (
<Switch>
<Route
path={"/instance-configurator/:action(new|edit)/:id?"}
render={props => <InstanceFormBuilder d2={d2} {...props} />}
render={props => <InstanceFormBuilder {...this.props} {...props} />}
/>

<Route
path="/instance-configurator"
render={props => <InstanceConfigurator d2={d2} {...props} />}
/>

<Route
path="/sync/organisationUnits"
render={props => <OrganisationUnitPage d2={d2} {...props} />}
/>

<Route
path="/sync/dataElements"
render={props => <DataElementPage d2={d2} {...props} />}
render={props => <InstanceConfigurator {...this.props} {...props} />}
/>

<Route
path="/sync/indicators"
render={props => <IndicatorPage d2={d2} {...props} />}
path="/sync/metadata"
render={props => <MetadataPage {...this.props} {...props} />}
/>

<Route
path="/sync/validationRules"
render={props => <ValidationRulePage d2={d2} {...props} />}
path="/sync/deleted"
render={props => <DeletedObjectsPage {...this.props} {...props} />}
/>

<Route
path="/sync/deleted"
render={props => <DeletedObjectsPage d2={d2} {...props} />}
path="/history/:id?"
render={props => <HistoryPage {...this.props} {...props} />}
/>

<Route path="/history/:id?" render={props => <HistoryPage d2={d2} {...props} />} />

<Route
path={"/synchronization-rules/:action(new|edit)/:id?"}
render={props => <SyncRulesWizard d2={d2} {...props} />}
render={props => <SyncRulesWizard {...this.props} {...props} />}
/>

<Route
path="/synchronization-rules"
render={props => <SyncRulesConfigurator d2={d2} {...props} />}
render={props => <SyncRulesConfigurator {...this.props} {...props} />}
/>

<Route render={() => <LandingPage d2={d2} />} />
<Route render={() => <LandingPage {...this.props} />} />
</Switch>
);
}
Expand Down
16 changes: 13 additions & 3 deletions src/components/instance-list-page/InstancesPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { ConfirmationDialog, ObjectsTable, withLoading, withSnackbar } from "d2-
import { withRouter } from "react-router-dom";

import PageHeader from "../page-header/PageHeader";

import Instance from "../../models/instance";
import { isAppConfigurator } from "../../utils/permissions";

class InstancesPage extends React.Component {
static propTypes = {
Expand All @@ -26,8 +26,16 @@ class InstancesPage extends React.Component {
state = {
tableKey: Math.random(),
toDelete: null,
appConfigurator: false,
};

async componentDidMount() {
const { d2 } = this.props;
const appConfigurator = await isAppConfigurator(d2);

this.setState({ appConfigurator });
}

columns = [
{ name: "name", text: i18n.t("Server name"), sortable: true },
{ name: "url", text: i18n.t("URL endpoint"), sortable: true },
Expand Down Expand Up @@ -76,12 +84,14 @@ class InstancesPage extends React.Component {
name: "edit",
text: i18n.t("Edit"),
multiple: false,
isActive: () => this.state.appConfigurator,
onClick: this.editInstance,
},
{
name: "delete",
text: i18n.t("Delete"),
multiple: true,
isActive: () => this.state.appConfigurator,
onClick: this.deleteInstance,
},
{
Expand Down Expand Up @@ -126,7 +136,7 @@ class InstancesPage extends React.Component {
};

render() {
const { tableKey, toDelete } = this.state;
const { tableKey, toDelete, appConfigurator } = this.state;
const { d2 } = this.props;

return (
Expand All @@ -153,7 +163,7 @@ class InstancesPage extends React.Component {
detailsFields={this.detailsFields}
pageSize={10}
actions={this.actions}
onButtonClick={this.createInstance}
onButtonClick={appConfigurator ? this.createInstance : null}
list={Instance.list}
/>
</React.Fragment>
Expand Down
Loading

0 comments on commit 7b7e210

Please sign in to comment.