[DEV] fix set of setting but the GUI does not work
This commit is contained in:
parent
faf60ed89b
commit
d28286a57c
@ -87,13 +87,14 @@ public class SystemConfigResource {
|
|||||||
@Path("key/{key}")
|
@Path("key/{key}")
|
||||||
@RolesAllowed(value = { "ADMIN" })
|
@RolesAllowed(value = { "ADMIN" })
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public void setKey(@Context final SecurityContext sc, @PathParam("key") final String key, final String jsonRequest)
|
public void setKey(
|
||||||
throws Exception {
|
@Context final SecurityContext sc,
|
||||||
|
@PathParam("key") final String key,
|
||||||
|
@AsyncType(Map.class) final String jsonRequest) throws Exception {
|
||||||
Settings res = null;
|
Settings res = null;
|
||||||
try {
|
try {
|
||||||
res = DataAccess.getWhere(Settings.class, new Condition(new QueryCondition("key", "=", key)));
|
res = DataAccess.getWhere(Settings.class, new Condition(new QueryCondition("key", "=", key)));
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
final String result = "Can not find the Key: '" + key + "'";
|
final String result = "Can not find the Key: '" + key + "'";
|
||||||
throw new NotFoundException(result);
|
throw new NotFoundException(result);
|
||||||
|
@ -59,7 +59,7 @@ export namespace SystemConfigResource {
|
|||||||
params: {
|
params: {
|
||||||
key: string,
|
key: string,
|
||||||
},
|
},
|
||||||
data: string,
|
data: any,
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
return RESTRequestVoid({
|
return RESTRequestVoid({
|
||||||
restModel: {
|
restModel: {
|
||||||
|
@ -163,13 +163,37 @@ export class SettingsScene implements OnInit {
|
|||||||
onUpdate(parent: SettingsItem222) {}
|
onUpdate(parent: SettingsItem222) {}
|
||||||
*/
|
*/
|
||||||
onUpdate(elem: SettingsItem222) {
|
onUpdate(elem: SettingsItem222) {
|
||||||
|
const self = this;
|
||||||
this.settingService.sets(elem.newValues)
|
this.settingService.sets(elem.newValues)
|
||||||
.then((result: object) => {
|
.then((result: object) => {
|
||||||
// TODO ...
|
console.log(`data is updated: ${JSON.stringify(result, null, 2)}`);
|
||||||
//multipleResponse.add(key, result);
|
let keys = Object.keys(result);
|
||||||
|
keys.forEach(key => {
|
||||||
|
console.log(` KEY='${key}'`);
|
||||||
|
const values = self.menu[0].values;
|
||||||
|
for (let iii = 0; iii < values.length; iii++) {
|
||||||
|
if (values[iii].key === key) {
|
||||||
|
console.log(` Find=${JSON.stringify(values[iii], null, 2)}`);
|
||||||
|
values[iii].value = values[iii].newValue;
|
||||||
|
values[iii].newValue = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
self.cdr.detectChanges();
|
||||||
})
|
})
|
||||||
.catch((error: any) => {
|
.catch((error: { fail: object, done: object }) => {
|
||||||
//multipleResponse.fail(key, error);
|
let keys = Object.keys(error.done);
|
||||||
|
keys.forEach(key => {
|
||||||
|
const values = self.menu[0].values;
|
||||||
|
for (let iii = 0; iii < values.length; iii++) {
|
||||||
|
if (values[iii].key === key) {
|
||||||
|
values[iii].value = values[iii].newValue;
|
||||||
|
values[iii].newValue = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,12 @@ class MultipleRequest {
|
|||||||
failResponse = undefined;
|
failResponse = undefined;
|
||||||
data = {};
|
data = {};
|
||||||
|
|
||||||
constructor(private resolve: any, private reject: any, private countRequest: number) { }
|
constructor(
|
||||||
|
private resolve: any,
|
||||||
|
private reject: any,
|
||||||
|
private countRequest: number,
|
||||||
|
) { }
|
||||||
|
|
||||||
add(key: string, value: any): void {
|
add(key: string, value: any): void {
|
||||||
this.requestDone += 1;
|
this.requestDone += 1;
|
||||||
this.data[key] = value;
|
this.data[key] = value;
|
||||||
@ -85,7 +90,9 @@ export class SettingsService {
|
|||||||
params: {
|
params: {
|
||||||
key
|
key
|
||||||
},
|
},
|
||||||
data: `${value}`
|
data: {
|
||||||
|
value: value
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user