[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}")
|
||||
@RolesAllowed(value = { "ADMIN" })
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public void setKey(@Context final SecurityContext sc, @PathParam("key") final String key, final String jsonRequest)
|
||||
throws Exception {
|
||||
public void setKey(
|
||||
@Context final SecurityContext sc,
|
||||
@PathParam("key") final String key,
|
||||
@AsyncType(Map.class) final String jsonRequest) throws Exception {
|
||||
Settings res = null;
|
||||
try {
|
||||
res = DataAccess.getWhere(Settings.class, new Condition(new QueryCondition("key", "=", key)));
|
||||
} catch (final Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
final String result = "Can not find the Key: '" + key + "'";
|
||||
throw new NotFoundException(result);
|
||||
|
@ -59,7 +59,7 @@ export namespace SystemConfigResource {
|
||||
params: {
|
||||
key: string,
|
||||
},
|
||||
data: string,
|
||||
data: any,
|
||||
}): Promise<void> {
|
||||
return RESTRequestVoid({
|
||||
restModel: {
|
||||
|
@ -163,13 +163,37 @@ export class SettingsScene implements OnInit {
|
||||
onUpdate(parent: SettingsItem222) {}
|
||||
*/
|
||||
onUpdate(elem: SettingsItem222) {
|
||||
const self = this;
|
||||
this.settingService.sets(elem.newValues)
|
||||
.then((result: object) => {
|
||||
// TODO ...
|
||||
//multipleResponse.add(key, result);
|
||||
console.log(`data is updated: ${JSON.stringify(result, null, 2)}`);
|
||||
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) => {
|
||||
//multipleResponse.fail(key, error);
|
||||
.catch((error: { fail: object, done: object }) => {
|
||||
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;
|
||||
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 {
|
||||
this.requestDone += 1;
|
||||
this.data[key] = value;
|
||||
@ -85,7 +90,9 @@ export class SettingsService {
|
||||
params: {
|
||||
key
|
||||
},
|
||||
data: `${value}`
|
||||
data: {
|
||||
value: value
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user