HM-126. Перенос хранилищ на новую модалку и логику, добавление работы… (#65)
This commit is contained in:
@ -1,12 +1,11 @@
|
||||
import Component from '../../../../core/components/component/Component';
|
||||
import storageApi from '../../api/StorageServiceAPI';
|
||||
import FilterApiComponent from '../filter-api-component/FilterApiComponent';
|
||||
import ApiInfoComponent from '../api-info-component/ApiInfoComponent';
|
||||
import CreateApiComponent from '../create-api-component/CreateApiComponent';
|
||||
import ButtonComponent from '../../../../core/components/button-component/ButtonComponent';
|
||||
import ApiTableComponent from '../api-table-component/ApiTableComponent';
|
||||
import ApiTableViewForm from '../api-table-view-form/ApiTableViewForm';
|
||||
import {EVENTS} from '../../../../core/consts';
|
||||
import {EVENTS, MODES} from '../../../../core/consts';
|
||||
import routeService from '../../../../services/RouteService';
|
||||
|
||||
class ApiPage extends Component {
|
||||
constructor (mainNodeSelector, parentNode) {
|
||||
@ -16,26 +15,31 @@ class ApiPage extends Component {
|
||||
|
||||
this.apiViewForm = this.createComponent(ApiTableViewForm);
|
||||
|
||||
this.infoBox = this.createComponent(ApiInfoComponent);
|
||||
this.createWindow = this.createComponent(CreateApiComponent);
|
||||
|
||||
this.createBtn = this.createComponent(ButtonComponent, this.filterBox.filterButtonBox, '✚', 'btn btn-primary mb-3 Create__btn');
|
||||
this.addSubscribe(this.createBtn, 'click', () => {
|
||||
this.createWindow.show();
|
||||
});
|
||||
this.addSubscribe(this.createWindow, 'renderTable', () => {
|
||||
this.initStorageListTable();
|
||||
this.addSubscribe(this.createBtn, EVENTS.CLICK, () => {
|
||||
routeService.pushQuery({mode: MODES.Create}, true);
|
||||
});
|
||||
|
||||
this.initStorageListTable();
|
||||
|
||||
this.addSubscribe(this.apiViewForm, 'deleteApi', () => {
|
||||
this.addSubscribe(this.apiViewForm, EVENTS.CREATE_STORE, async (store) => {
|
||||
await storageApi.create(store);
|
||||
this.initStorageListTable();
|
||||
});
|
||||
|
||||
this.addSubscribe(this.apiViewForm, EVENTS.SAVE_STORE, async (store) => {
|
||||
await storageApi.update(store);
|
||||
this.initStorageListTable();
|
||||
});
|
||||
|
||||
this.addSubscribe(this.apiViewForm, EVENTS.DELETE_STORE, async (storeKey) => {
|
||||
await storageApi.remove(storeKey);
|
||||
this.initStorageListTable();
|
||||
});
|
||||
|
||||
this.apiTable = this.createComponent(ApiTableComponent, this.mainNode);
|
||||
this.addSubscribe(this.apiTable, EVENTS.ROW_DOUBLE_CLICK, (_, row) => {
|
||||
this.apiViewForm.setForm(row);
|
||||
routeService.pushQuery({mode: MODES.View, key: row.key}, true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user