Skip to content

Commit e360566

Browse files
authored
Prepare release (#88)
* fixed filters name * fix name and change filters behaviur * refresh token * update changelog * lint * fix
1 parent 25e17d4 commit e360566

12 files changed

+118
-15
lines changed

RELEASE_NOTES.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
- The values displayed on the policyForm are from Keycloack
88
- Components are now totally indipendent from the API
99
- Migration to realm v0.0.6
10+
- Token refresh on new Tenant
1011

1112
### Bug fixes
1213

1314
- Change the Group from name to path
15+
- Fixed filters margin top
16+
- Filters name
17+
- filters behaviur when another tenant is selected
1418

1519
### Documentation
1620

src/App.js

+1
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ export default class App extends Component {
475475
<AuthorizedElement tokenDecoded={this.state.tokenData} iSuperAdmin={true}>
476476
<TenantPage
477477
token={this.props.accessToken}
478+
renewTokens={this.props.renewTokens}
478479
env={env}
479480
getTenants={this.state.getTenants}
480481
tenantValues={this.state.tenants}

src/components/policy/filters/actorFilter.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,22 @@ export default function ActorFilter({ data, status, setstatus, filterValue }) {
100100
options={data}
101101
defaultValue={filterValue.value}
102102
getOptionLabel={(option) => option.name}
103-
renderInput={(params) => <TextField {...params} label="Actor" placeholder="Actor" />}
103+
renderInput={(params) => (
104+
<TextField
105+
{...params}
106+
label={
107+
<Trans
108+
i18nKey="policies.filters.actor"
109+
values={{
110+
name: ''
111+
}}
112+
/>
113+
}
114+
/>
115+
)}
104116
onChange={(event, value) => filterValue.set(value)}
105117
isOptionEqualToValue={(option, value) => option.iri === value.iri}
106-
sx={{ width: '100%', marginTop: '10px' }}
118+
sx={{ width: '100%', marginTop: '2%' }}
107119
/>
108120
</Grow>
109121
</Grid>

src/components/policy/filters/actorTypeFilter.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,22 @@ export default function ActorTypeFilter({ data, status, setstatus, filterValue }
9999
options={data}
100100
defaultValue={filterValue.value}
101101
getOptionLabel={(option) => option.name}
102-
renderInput={(params) => <TextField {...params} label="Actor type" placeholder="Actor type" />}
102+
renderInput={(params) => (
103+
<TextField
104+
{...params}
105+
label={
106+
<Trans
107+
i18nKey="policies.filters.actor_type"
108+
values={{
109+
name: ''
110+
}}
111+
/>
112+
}
113+
/>
114+
)}
103115
onChange={(event, value) => filterValue.set(value)}
104116
isOptionEqualToValue={(option, value) => option.iri === value.iri}
105-
sx={{ width: '100%', marginTop: '10px' }}
117+
sx={{ width: '100%', marginTop: '2%' }}
106118
/>
107119
</Grow>
108120
</Grid>

src/components/policy/filters/modeFilter.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,22 @@ export default function ModeFilter({ data, status, setstatus, filterValue }) {
9999
options={data}
100100
defaultValue={filterValue.value}
101101
getOptionLabel={(option) => option.name}
102-
renderInput={(params) => <TextField {...params} label="Mode" placeholder="Mode" />}
102+
renderInput={(params) => (
103+
<TextField
104+
{...params}
105+
label={
106+
<Trans
107+
i18nKey="policies.filters.mode"
108+
values={{
109+
name: ''
110+
}}
111+
/>
112+
}
113+
/>
114+
)}
103115
onChange={(event, value) => filterValue.set(value)}
104116
isOptionEqualToValue={(option, value) => option.iri === value.iri}
105-
sx={{ width: '100%', marginTop: '10px' }}
117+
sx={{ width: '100%', marginTop: '2%' }}
106118
/>
107119
</Grow>
108120
</Grid>

src/components/policy/filters/pathFilter.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,22 @@ export default function PathFilter({ data, status, setstatus, filterValue }) {
9999
options={data}
100100
getOptionLabel={(option) => option.fiware_service_path}
101101
defaultValue={filterValue.value}
102-
renderInput={(params) => <TextField {...params} label="Path" placeholder="Path" />}
102+
renderInput={(params) => (
103+
<TextField
104+
{...params}
105+
label={
106+
<Trans
107+
i18nKey="policies.filters.path"
108+
values={{
109+
name: ''
110+
}}
111+
/>
112+
}
113+
/>
114+
)}
103115
onChange={(event, value) => filterValue.set(value)}
104116
isOptionEqualToValue={(option, value) => option.fiware_service_path === value.fiware_service_path}
105-
sx={{ width: '100%', marginTop: '10px' }}
117+
sx={{ width: '100%', marginTop: '2%' }}
106118
/>
107119
</Grow>
108120
</Grid>

src/components/policy/filters/resourceFilter.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,22 @@ export default function AcessToFilter({ data, status, setstatus, filterValue })
9999
options={data}
100100
getOptionLabel={(option) => option.access_to}
101101
defaultValue={filterValue.value}
102-
renderInput={(params) => <TextField {...params} label="Resource Type" placeholder="Resource Type" />}
102+
renderInput={(params) => (
103+
<TextField
104+
{...params}
105+
label={
106+
<Trans
107+
i18nKey="policies.filters.resource"
108+
values={{
109+
name: ''
110+
}}
111+
/>
112+
}
113+
/>
114+
)}
103115
onChange={(event, value) => filterValue.set(value)}
104116
isOptionEqualToValue={(option, value) => option.access_to === value.access_to}
105-
sx={{ width: '100%', marginTop: '10px' }}
117+
sx={{ width: '100%', marginTop: '2%' }}
106118
/>
107119
</Grow>
108120
</Grid>

src/components/policy/filters/typeFilter.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,22 @@ export default function ResourceTypeFilter({ data, status, setstatus, filterValu
9999
options={data}
100100
getOptionLabel={(option) => option.resource_type}
101101
defaultValue={filterValue.value}
102-
renderInput={(params) => <TextField {...params} label="Resource Type" placeholder="Resource Type" />}
102+
renderInput={(params) => (
103+
<TextField
104+
{...params}
105+
label={
106+
<Trans
107+
i18nKey="policies.filters.resource_type"
108+
values={{
109+
name: ''
110+
}}
111+
/>
112+
}
113+
/>
114+
)}
103115
onChange={(event, value) => filterValue.set(value)}
104116
isOptionEqualToValue={(option, value) => option.resource_type === value.resource_type}
105-
sx={{ width: '100%', marginTop: '10px' }}
117+
sx={{ width: '100%', marginTop: '2%' }}
106118
/>
107119
</Grow>
108120
</Grid>

src/components/tenant/tenantForm.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const CustomDialogTitle = styled(AppBar)({
2727
boxShadow: 'none'
2828
});
2929

30-
export default function TenantForm({ title, close, action, tenant, getTenants, token, env }) {
30+
export default function TenantForm({ title, close, action, tenant, getTenants, token, env, renewTokens }) {
3131
typeof env === 'undefined' ? log.setDefaultLevel('debug') : log.setLevel(env.LOG_LEVEL);
3232
const anubisURL = typeof env !== 'undefined' ? env.ANUBIS_API_URL : '';
3333

@@ -108,6 +108,7 @@ export default function TenantForm({ title, close, action, tenant, getTenants, t
108108
),
109109
variant: 'success'
110110
});
111+
renewTokens();
111112
getTenants();
112113
})
113114
.catch((e) => {

src/index.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ function LoginMockup() {
2323
const { idTokenPayload } = useOidcIdToken();
2424
const { accessToken } = useOidcAccessToken();
2525
return (
26-
<App login={login} isAuthenticated={isAuthenticated} accessToken={accessToken} idTokenPayload={idTokenPayload} />
26+
<App
27+
login={login}
28+
renewTokens={login}
29+
isAuthenticated={isAuthenticated}
30+
accessToken={accessToken}
31+
idTokenPayload={idTokenPayload}
32+
/>
2733
);
2834
}
2935

src/pages/policyPage.js

+9
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,15 @@ export default function PolicyPage({ getTenants, tenantValues, thisTenant, graph
198198
}
199199
};
200200

201+
React.useEffect(() => {
202+
setMode(null);
203+
setAgent(null);
204+
setResource(null);
205+
setResourceType(null);
206+
setAgentype(null);
207+
setPolicyFilter(null);
208+
}, [thisTenant]);
209+
201210
React.useEffect(() => {
202211
if (policies.length > 0) {
203212
getPoliciesFiltered(services);

src/pages/tenantPage.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ import { Trans } from 'react-i18next';
1010
import Box from '@mui/material/Box';
1111
import Typography from '@mui/material/Typography';
1212

13-
export default function TenantPage({ tenantValues, getTenants, seTenant, client, token, graphqlErrors, env }) {
13+
export default function TenantPage({
14+
tenantValues,
15+
getTenants,
16+
seTenant,
17+
client,
18+
token,
19+
graphqlErrors,
20+
env,
21+
renewTokens
22+
}) {
1423
const [createOpen, setCreateOpen] = React.useState(false);
1524
const [sortedTenants, sortTenants] = React.useState([]);
1625
const [count, counter] = React.useState(1);
@@ -31,6 +40,7 @@ export default function TenantPage({ tenantValues, getTenants, seTenant, client,
3140
<TenantForm
3241
env={env}
3342
token={token}
43+
renewTokens={renewTokens}
3444
client={client}
3545
title={<Trans>tenant.titles.new</Trans>}
3646
close={setCreateOpen}

0 commit comments

Comments
 (0)