jamespot-front-business 1.1.32 → 1.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs.js +205 -46
- package/dist/cjs.js.map +1 -1
- package/dist/esm.js +205 -46
- package/dist/esm.js.map +1 -1
- package/dist/types.d.ts +59 -2
- package/package.json +1 -1
package/dist/cjs.js
CHANGED
|
@@ -68,7 +68,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
const initialState$
|
|
71
|
+
const initialState$h = {
|
|
72
72
|
entities: [],
|
|
73
73
|
loading: 'idle',
|
|
74
74
|
nbResults: 0,
|
|
@@ -79,7 +79,7 @@ const fetchBookableAsset = toolkit.createAsyncThunk('BookableAsset/fetchBookable
|
|
|
79
79
|
}));
|
|
80
80
|
const BookableAssetSlice = toolkit.createSlice({
|
|
81
81
|
name: 'bookableAsset',
|
|
82
|
-
initialState: initialState$
|
|
82
|
+
initialState: initialState$h,
|
|
83
83
|
reducers: {},
|
|
84
84
|
extraReducers: (builder) => {
|
|
85
85
|
builder
|
|
@@ -100,7 +100,7 @@ const BookableAssetSlice = toolkit.createSlice({
|
|
|
100
100
|
const fetchConfiguration = toolkit.createAsyncThunk('AssetReservation/configuration', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
101
101
|
return yield extra.jApi.assetReservation.configuration();
|
|
102
102
|
}));
|
|
103
|
-
const initialState$
|
|
103
|
+
const initialState$g = {
|
|
104
104
|
description: '',
|
|
105
105
|
right: {
|
|
106
106
|
manage: false,
|
|
@@ -114,7 +114,7 @@ const initialState$f = {
|
|
|
114
114
|
};
|
|
115
115
|
const AssetReservationConfigurationSlice = toolkit.createSlice({
|
|
116
116
|
name: 'configuration',
|
|
117
|
-
initialState: initialState$
|
|
117
|
+
initialState: initialState$g,
|
|
118
118
|
reducers: {},
|
|
119
119
|
extraReducers: (builder) => {
|
|
120
120
|
builder
|
|
@@ -135,7 +135,7 @@ const initForm = {
|
|
|
135
135
|
hourStart: '',
|
|
136
136
|
hourEnd: '',
|
|
137
137
|
};
|
|
138
|
-
const initialState$
|
|
138
|
+
const initialState$f = {
|
|
139
139
|
entities: [],
|
|
140
140
|
loading: 'idle',
|
|
141
141
|
nbResults: 0,
|
|
@@ -147,7 +147,7 @@ const fetchReservation = toolkit.createAsyncThunk('Reservation/fetchReservation'
|
|
|
147
147
|
}));
|
|
148
148
|
const ReservationSlice = toolkit.createSlice({
|
|
149
149
|
name: 'reservation',
|
|
150
|
-
initialState: initialState$
|
|
150
|
+
initialState: initialState$f,
|
|
151
151
|
reducers: {
|
|
152
152
|
setForm: (state, action) => {
|
|
153
153
|
state.form = action.payload;
|
|
@@ -240,7 +240,7 @@ const Toast = {
|
|
|
240
240
|
selectors: selectors$1,
|
|
241
241
|
};
|
|
242
242
|
|
|
243
|
-
const initialState$
|
|
243
|
+
const initialState$e = {
|
|
244
244
|
bookmarks: [],
|
|
245
245
|
loading: 'idle',
|
|
246
246
|
status: undefined,
|
|
@@ -303,7 +303,7 @@ const deleteBookmark = toolkit.createAsyncThunk('bookmarkList/deleteBookmark', (
|
|
|
303
303
|
}));
|
|
304
304
|
const BookmarkListSlice = toolkit.createSlice({
|
|
305
305
|
name: 'bookmarkList',
|
|
306
|
-
initialState: initialState$
|
|
306
|
+
initialState: initialState$e,
|
|
307
307
|
reducers: {
|
|
308
308
|
resetAddBookmarkStatus: (state, action) => {
|
|
309
309
|
if (state.add[action.payload]) {
|
|
@@ -466,7 +466,7 @@ const getRTHandlers = function (dispatch) {
|
|
|
466
466
|
];
|
|
467
467
|
};
|
|
468
468
|
|
|
469
|
-
const initialState$
|
|
469
|
+
const initialState$d = {
|
|
470
470
|
bookmark: undefined,
|
|
471
471
|
status: undefined,
|
|
472
472
|
loading: 'idle',
|
|
@@ -488,7 +488,7 @@ const editBookmark = toolkit.createAsyncThunk('bookmarkEdit/editBookmark', (book
|
|
|
488
488
|
}));
|
|
489
489
|
const BookmarkEditSlice = toolkit.createSlice({
|
|
490
490
|
name: 'bookmarkEdit',
|
|
491
|
-
initialState: initialState$
|
|
491
|
+
initialState: initialState$d,
|
|
492
492
|
reducers: {
|
|
493
493
|
setEditBookmark: (state, action) => {
|
|
494
494
|
state.bookmark = Object.assign({}, action.payload);
|
|
@@ -541,7 +541,7 @@ const Bookmark = {
|
|
|
541
541
|
getRTHandlers: getRTHandlers,
|
|
542
542
|
};
|
|
543
543
|
|
|
544
|
-
const initialState$
|
|
544
|
+
const initialState$c = {
|
|
545
545
|
loading: 'idle',
|
|
546
546
|
access: { createCategory: false },
|
|
547
547
|
};
|
|
@@ -569,7 +569,7 @@ const fetchFaqConfig = toolkit.createAsyncThunk('faqConfig/fetch', () => __await
|
|
|
569
569
|
}));
|
|
570
570
|
const FaqConfigSlice = toolkit.createSlice({
|
|
571
571
|
name: 'config',
|
|
572
|
-
initialState: initialState$
|
|
572
|
+
initialState: initialState$c,
|
|
573
573
|
reducers: {},
|
|
574
574
|
extraReducers: (builder) => {
|
|
575
575
|
builder
|
|
@@ -601,7 +601,7 @@ const FaqConfigSlice = toolkit.createSlice({
|
|
|
601
601
|
},
|
|
602
602
|
});
|
|
603
603
|
|
|
604
|
-
const initialState$
|
|
604
|
+
const initialState$b = {
|
|
605
605
|
loading: 'idle',
|
|
606
606
|
categories: null,
|
|
607
607
|
};
|
|
@@ -613,7 +613,7 @@ const fetchFaqCategories = toolkit.createAsyncThunk('faqCategories/fetch', () =>
|
|
|
613
613
|
}));
|
|
614
614
|
const FaqCategoriesSlice = toolkit.createSlice({
|
|
615
615
|
name: 'categories',
|
|
616
|
-
initialState: initialState$
|
|
616
|
+
initialState: initialState$b,
|
|
617
617
|
reducers: {},
|
|
618
618
|
extraReducers: (builder) => {
|
|
619
619
|
builder
|
|
@@ -895,7 +895,7 @@ const initialMap = {
|
|
|
895
895
|
illustration: '',
|
|
896
896
|
assignLicense: false,
|
|
897
897
|
};
|
|
898
|
-
const initialState$
|
|
898
|
+
const initialState$a = {
|
|
899
899
|
map: Object.assign({}, initialMap),
|
|
900
900
|
loading: 'idle',
|
|
901
901
|
status: undefined,
|
|
@@ -939,13 +939,13 @@ const createMap = toolkit.createAsyncThunk('mapCreate/create', ({ map, jlandUrlB
|
|
|
939
939
|
}));
|
|
940
940
|
const MapCreateSlice = toolkit.createSlice({
|
|
941
941
|
name: 'mapCreate',
|
|
942
|
-
initialState: initialState$
|
|
942
|
+
initialState: initialState$a,
|
|
943
943
|
reducers: {
|
|
944
944
|
setMap: (state, action) => {
|
|
945
945
|
state.map = action.payload;
|
|
946
946
|
},
|
|
947
947
|
resetCreateMapState: () => {
|
|
948
|
-
return initialState$
|
|
948
|
+
return initialState$a;
|
|
949
949
|
},
|
|
950
950
|
},
|
|
951
951
|
extraReducers: (builder) => {
|
|
@@ -1032,10 +1032,10 @@ const Model = {
|
|
|
1032
1032
|
selectors: Object.assign(Object.assign({}, selectors), { selectByIds }),
|
|
1033
1033
|
};
|
|
1034
1034
|
|
|
1035
|
-
const initialState$
|
|
1035
|
+
const initialState$9 = {};
|
|
1036
1036
|
const NetworkStaticsSlice = toolkit.createSlice({
|
|
1037
1037
|
name: 'statics',
|
|
1038
|
-
initialState: initialState$
|
|
1038
|
+
initialState: initialState$9,
|
|
1039
1039
|
reducers: {
|
|
1040
1040
|
initNetworkStatics: (_, { payload }) => {
|
|
1041
1041
|
return payload;
|
|
@@ -1091,7 +1091,7 @@ const fetchRecentFiles = toolkit.createAsyncThunk('/fetchRecentFiles', (_, { ext
|
|
|
1091
1091
|
return yield jApi.wedoc.getFiles(Object.assign(Object.assign({}, initialQuery), { filters, limit: 4 }));
|
|
1092
1092
|
}));
|
|
1093
1093
|
|
|
1094
|
-
const initialState$
|
|
1094
|
+
const initialState$8 = {
|
|
1095
1095
|
entities: [],
|
|
1096
1096
|
nbEntities: 0,
|
|
1097
1097
|
entitiesRecent: [],
|
|
@@ -1103,7 +1103,7 @@ const initialState$7 = {
|
|
|
1103
1103
|
};
|
|
1104
1104
|
const WedocAppSlice = toolkit.createSlice({
|
|
1105
1105
|
name: 'wedoc',
|
|
1106
|
-
initialState: initialState$
|
|
1106
|
+
initialState: initialState$8,
|
|
1107
1107
|
reducers: {
|
|
1108
1108
|
update: (state, action) => {
|
|
1109
1109
|
state.entities = [
|
|
@@ -1176,14 +1176,14 @@ const fetchRequest = toolkit.createAsyncThunk('/fetchRequest', ({ uri, idUser },
|
|
|
1176
1176
|
return yield jApi.wedoc.getAccessRequest(uri, idUser);
|
|
1177
1177
|
}));
|
|
1178
1178
|
|
|
1179
|
-
const initialState$
|
|
1179
|
+
const initialState$7 = {
|
|
1180
1180
|
entities: [],
|
|
1181
1181
|
nbEntities: 0,
|
|
1182
1182
|
loading: 'idle',
|
|
1183
1183
|
};
|
|
1184
1184
|
const ShareSlice = toolkit.createSlice({
|
|
1185
1185
|
name: 'share',
|
|
1186
|
-
initialState: initialState$
|
|
1186
|
+
initialState: initialState$7,
|
|
1187
1187
|
reducers: {
|
|
1188
1188
|
remove: (state, action) => {
|
|
1189
1189
|
state.entities = [
|
|
@@ -1221,7 +1221,7 @@ const Share = {
|
|
|
1221
1221
|
},
|
|
1222
1222
|
};
|
|
1223
1223
|
|
|
1224
|
-
const initialState$
|
|
1224
|
+
const initialState$6 = {
|
|
1225
1225
|
channels: undefined,
|
|
1226
1226
|
loading: 'idle',
|
|
1227
1227
|
loadingChannelDeletion: 'idle',
|
|
@@ -1264,7 +1264,7 @@ const deleteChannel = toolkit.createAsyncThunk('/deleteChannel', ({ channel }, {
|
|
|
1264
1264
|
}));
|
|
1265
1265
|
const ChannelsListSlice = toolkit.createSlice({
|
|
1266
1266
|
name: 'channelsList',
|
|
1267
|
-
initialState: Object.assign({}, initialState$
|
|
1267
|
+
initialState: Object.assign({}, initialState$6),
|
|
1268
1268
|
reducers: {},
|
|
1269
1269
|
extraReducers: (builder) => {
|
|
1270
1270
|
builder
|
|
@@ -1333,10 +1333,10 @@ const TVDisplay = {
|
|
|
1333
1333
|
},
|
|
1334
1334
|
};
|
|
1335
1335
|
|
|
1336
|
-
const initialState$
|
|
1336
|
+
const initialState$5 = {};
|
|
1337
1337
|
const TinyMCEOptionsSlice = toolkit.createSlice({
|
|
1338
1338
|
name: 'options',
|
|
1339
|
-
initialState: initialState$
|
|
1339
|
+
initialState: initialState$5,
|
|
1340
1340
|
reducers: {
|
|
1341
1341
|
initOptions: (_, { payload }) => {
|
|
1342
1342
|
return { common: payload };
|
|
@@ -1362,7 +1362,7 @@ const TinyMCE = {
|
|
|
1362
1362
|
},
|
|
1363
1363
|
};
|
|
1364
1364
|
|
|
1365
|
-
const initialState$
|
|
1365
|
+
const initialState$4 = {
|
|
1366
1366
|
id: 0,
|
|
1367
1367
|
mainType: 'user',
|
|
1368
1368
|
type: 'user',
|
|
@@ -1376,7 +1376,7 @@ const initialState$3 = {
|
|
|
1376
1376
|
};
|
|
1377
1377
|
const slice = toolkit.createSlice({
|
|
1378
1378
|
name: 'userCurrent',
|
|
1379
|
-
initialState: initialState$
|
|
1379
|
+
initialState: initialState$4,
|
|
1380
1380
|
reducers: {
|
|
1381
1381
|
init: (_, { payload }) => {
|
|
1382
1382
|
return payload;
|
|
@@ -1594,7 +1594,7 @@ function widgetDefinition(name) {
|
|
|
1594
1594
|
|
|
1595
1595
|
const MODE_EDIT = 'edit';
|
|
1596
1596
|
const MODE_VIEW = 'view';
|
|
1597
|
-
const initialState$
|
|
1597
|
+
const initialState$3 = {
|
|
1598
1598
|
token: undefined,
|
|
1599
1599
|
ids: {},
|
|
1600
1600
|
layers: {},
|
|
@@ -1606,7 +1606,7 @@ const initialState$2 = {
|
|
|
1606
1606
|
};
|
|
1607
1607
|
const widgetsSlice = toolkit.createSlice({
|
|
1608
1608
|
name: 'widgets',
|
|
1609
|
-
initialState: initialState$
|
|
1609
|
+
initialState: initialState$3,
|
|
1610
1610
|
reducers: {
|
|
1611
1611
|
registerWidget: (state, action) => {
|
|
1612
1612
|
const { uniqid, widget } = action.payload;
|
|
@@ -1748,12 +1748,12 @@ const Widget = {
|
|
|
1748
1748
|
},
|
|
1749
1749
|
};
|
|
1750
1750
|
|
|
1751
|
-
const initialState$
|
|
1751
|
+
const initialState$2 = {
|
|
1752
1752
|
editors: [],
|
|
1753
1753
|
};
|
|
1754
1754
|
const editorsSlice = toolkit.createSlice({
|
|
1755
1755
|
name: 'editors',
|
|
1756
|
-
initialState: initialState$
|
|
1756
|
+
initialState: initialState$2,
|
|
1757
1757
|
reducers: {
|
|
1758
1758
|
registerEditor: (state, action) => {
|
|
1759
1759
|
const { uniqid, name } = action.payload;
|
|
@@ -1979,6 +1979,85 @@ function serverAppsToStudioApps(serverApps) {
|
|
|
1979
1979
|
return studioApps;
|
|
1980
1980
|
}
|
|
1981
1981
|
|
|
1982
|
+
const initialState$1 = {
|
|
1983
|
+
currentStudioApp: null,
|
|
1984
|
+
fetchCurrentStudioAppStatus: 'idle',
|
|
1985
|
+
saveCurrentStudioAppStatus: 'idle',
|
|
1986
|
+
};
|
|
1987
|
+
const fetchCurrentStudioApp = toolkit.createAsyncThunk('studio/fetchCurrentStudioApp', ({ idApp, status }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1988
|
+
const jApi = extra.jApi;
|
|
1989
|
+
const error = { error: 1, errorMsg: 'Error fetching application' };
|
|
1990
|
+
try {
|
|
1991
|
+
const studioApplicationBase = (yield jApi.application.get(idApp, status)).result;
|
|
1992
|
+
const studioApplication = serverAppsToStudioApps([studioApplicationBase])[0];
|
|
1993
|
+
if (!studioApplication) {
|
|
1994
|
+
return rejectWithValue(error);
|
|
1995
|
+
}
|
|
1996
|
+
return studioApplication;
|
|
1997
|
+
}
|
|
1998
|
+
catch (_) {
|
|
1999
|
+
return rejectWithValue(error);
|
|
2000
|
+
}
|
|
2001
|
+
}));
|
|
2002
|
+
const saveCurrentStudioApp = toolkit.createAsyncThunk('studio/saveCurrentStudioApp', (_, { extra, rejectWithValue, getState, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2003
|
+
const jApi = extra.jApi;
|
|
2004
|
+
const error = { error: 1, errorMsg: 'Error saving application' };
|
|
2005
|
+
const currentStudioApp = getState().studio.currentStudioApp.currentStudioApp;
|
|
2006
|
+
if (!currentStudioApp) {
|
|
2007
|
+
return rejectWithValue(error);
|
|
2008
|
+
}
|
|
2009
|
+
const stringifiedApp = JSON.stringify(currentStudioApp);
|
|
2010
|
+
try {
|
|
2011
|
+
yield jApi.application.save(currentStudioApp.idApp, stringifiedApp, 'saved');
|
|
2012
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Edition_Saved' }));
|
|
2013
|
+
return;
|
|
2014
|
+
}
|
|
2015
|
+
catch (_) {
|
|
2016
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2017
|
+
return rejectWithValue(error);
|
|
2018
|
+
}
|
|
2019
|
+
}));
|
|
2020
|
+
const CurrentStudioAppSlice = toolkit.createSlice({
|
|
2021
|
+
name: 'currentStudioApp',
|
|
2022
|
+
initialState: initialState$1,
|
|
2023
|
+
reducers: {
|
|
2024
|
+
setCurrentApp: (state, action) => {
|
|
2025
|
+
state.currentStudioApp = action.payload;
|
|
2026
|
+
},
|
|
2027
|
+
resetCurrentApp: (state) => {
|
|
2028
|
+
state.currentStudioApp = null;
|
|
2029
|
+
},
|
|
2030
|
+
},
|
|
2031
|
+
extraReducers: (builder) => {
|
|
2032
|
+
builder
|
|
2033
|
+
.addCase(fetchCurrentStudioApp.pending, (state) => {
|
|
2034
|
+
if (state.fetchCurrentStudioAppStatus === 'idle')
|
|
2035
|
+
state.fetchCurrentStudioAppStatus = 'pending';
|
|
2036
|
+
})
|
|
2037
|
+
.addCase(fetchCurrentStudioApp.fulfilled, (state, action) => {
|
|
2038
|
+
if (state.fetchCurrentStudioAppStatus === 'pending')
|
|
2039
|
+
state.fetchCurrentStudioAppStatus = 'idle';
|
|
2040
|
+
state.currentStudioApp = action.payload;
|
|
2041
|
+
})
|
|
2042
|
+
.addCase(fetchCurrentStudioApp.rejected, (state) => {
|
|
2043
|
+
if (state.fetchCurrentStudioAppStatus === 'pending')
|
|
2044
|
+
state.fetchCurrentStudioAppStatus = 'idle';
|
|
2045
|
+
})
|
|
2046
|
+
.addCase(saveCurrentStudioApp.pending, (state) => {
|
|
2047
|
+
if (state.saveCurrentStudioAppStatus === 'idle')
|
|
2048
|
+
state.saveCurrentStudioAppStatus = 'pending';
|
|
2049
|
+
})
|
|
2050
|
+
.addCase(saveCurrentStudioApp.fulfilled, (state) => {
|
|
2051
|
+
if (state.saveCurrentStudioAppStatus === 'pending')
|
|
2052
|
+
state.saveCurrentStudioAppStatus = 'idle';
|
|
2053
|
+
})
|
|
2054
|
+
.addCase(saveCurrentStudioApp.rejected, (state) => {
|
|
2055
|
+
if (state.saveCurrentStudioAppStatus === 'pending')
|
|
2056
|
+
state.saveCurrentStudioAppStatus = 'idle';
|
|
2057
|
+
});
|
|
2058
|
+
},
|
|
2059
|
+
});
|
|
2060
|
+
|
|
1982
2061
|
function cloneStudioAppFromExistingApp(existingApp, author) {
|
|
1983
2062
|
const newApp = existingApp.inWorkVersion
|
|
1984
2063
|
? JSON.parse(JSON.stringify(existingApp.inWorkVersion))
|
|
@@ -1991,6 +2070,37 @@ function cloneStudioAppFromExistingApp(existingApp, author) {
|
|
|
1991
2070
|
return [newApp, newAppId];
|
|
1992
2071
|
}
|
|
1993
2072
|
|
|
2073
|
+
function createNewStudioApp$1({ author, appName }) {
|
|
2074
|
+
const newAppId = uuid.v4();
|
|
2075
|
+
return {
|
|
2076
|
+
newAppId,
|
|
2077
|
+
newStudioApp: {
|
|
2078
|
+
idApp: newAppId,
|
|
2079
|
+
status: APP_STATUS_TYPE.DRAFT,
|
|
2080
|
+
author: author || '',
|
|
2081
|
+
manifest: {
|
|
2082
|
+
appShortName: appName,
|
|
2083
|
+
appName: appName,
|
|
2084
|
+
author: author || '',
|
|
2085
|
+
description: '',
|
|
2086
|
+
typeLabel: '',
|
|
2087
|
+
cssColor: '#392994',
|
|
2088
|
+
cssClass: {
|
|
2089
|
+
label: 'star',
|
|
2090
|
+
value: 'star',
|
|
2091
|
+
},
|
|
2092
|
+
version: 0.1,
|
|
2093
|
+
dateCreation: new Date().toISOString(),
|
|
2094
|
+
viewSolr: 'solr',
|
|
2095
|
+
checkAccess: false,
|
|
2096
|
+
accessRightList: '',
|
|
2097
|
+
attrExposed: [],
|
|
2098
|
+
articlesCount: 0,
|
|
2099
|
+
},
|
|
2100
|
+
},
|
|
2101
|
+
};
|
|
2102
|
+
}
|
|
2103
|
+
|
|
1994
2104
|
const initialState = {
|
|
1995
2105
|
studioAppsList: [],
|
|
1996
2106
|
loadingStudioAppsList: 'idle',
|
|
@@ -1998,8 +2108,9 @@ const initialState = {
|
|
|
1998
2108
|
suspendStudioAppStatus: 'idle',
|
|
1999
2109
|
restartStudioAppStatus: 'idle',
|
|
2000
2110
|
cloneStudioAppStatus: 'idle',
|
|
2111
|
+
createNewStudioAppStatus: 'idle',
|
|
2001
2112
|
};
|
|
2002
|
-
const fetchStudioAppsList = toolkit.createAsyncThunk('studio/appsList', (_, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2113
|
+
const fetchStudioAppsList = toolkit.createAsyncThunk('studio/appsList', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2003
2114
|
const jApi = extra.jApi;
|
|
2004
2115
|
try {
|
|
2005
2116
|
const { result } = yield jApi.application.list();
|
|
@@ -2010,50 +2121,76 @@ const fetchStudioAppsList = toolkit.createAsyncThunk('studio/appsList', (_, { ex
|
|
|
2010
2121
|
})));
|
|
2011
2122
|
}
|
|
2012
2123
|
catch (_) {
|
|
2013
|
-
|
|
2124
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2125
|
+
throw rejectWithValue({ error: 1, errorMsg: 'Error retrieving applications' });
|
|
2126
|
+
}
|
|
2127
|
+
}));
|
|
2128
|
+
const createNewStudioApp = toolkit.createAsyncThunk('studio/createApp', ({ appName }, { extra, dispatch, rejectWithValue, getState }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2129
|
+
var _a;
|
|
2130
|
+
const jApi = extra.jApi;
|
|
2131
|
+
const author = (_a = getState().userCurrent) === null || _a === void 0 ? void 0 : _a.uri;
|
|
2132
|
+
const { newAppId, newStudioApp } = createNewStudioApp$1(Object.assign({ appName }, (author && { author })));
|
|
2133
|
+
try {
|
|
2134
|
+
yield jApi.application.save(newAppId, JSON.stringify(newStudioApp), 'saved');
|
|
2135
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Created' }));
|
|
2136
|
+
dispatch(CurrentStudioAppSlice.actions.setCurrentApp(newStudioApp));
|
|
2137
|
+
return newStudioApp;
|
|
2138
|
+
}
|
|
2139
|
+
catch (_) {
|
|
2140
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2141
|
+
throw rejectWithValue({ error: 1, errorMsg: 'Error creating application' });
|
|
2014
2142
|
}
|
|
2015
2143
|
}));
|
|
2016
|
-
const deleteStudioApp = toolkit.createAsyncThunk('studio/deleteApp', ({ idApp, status }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2144
|
+
const deleteStudioApp = toolkit.createAsyncThunk('studio/deleteApp', ({ idApp, status }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2017
2145
|
const jApi = extra.jApi;
|
|
2018
2146
|
try {
|
|
2019
|
-
|
|
2147
|
+
const deleteRes = yield jApi.application.delete(idApp, status);
|
|
2148
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Deleted' }));
|
|
2149
|
+
return deleteRes;
|
|
2020
2150
|
}
|
|
2021
2151
|
catch (_) {
|
|
2152
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2022
2153
|
return rejectWithValue({ error: 1, errorMsg: 'Error deleting application' });
|
|
2023
2154
|
}
|
|
2024
2155
|
}));
|
|
2025
|
-
const suspendStudioApp = toolkit.createAsyncThunk('studio/suspendStudioApp', ({ idApp }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2156
|
+
const suspendStudioApp = toolkit.createAsyncThunk('studio/suspendStudioApp', ({ idApp }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2026
2157
|
const jApi = extra.jApi;
|
|
2027
2158
|
try {
|
|
2028
2159
|
yield jApi.application.suspend(idApp);
|
|
2160
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Suspended' }));
|
|
2029
2161
|
}
|
|
2030
2162
|
catch (_) {
|
|
2163
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2031
2164
|
throw rejectWithValue({ error: 1, errorMsg: 'Error suspending application' });
|
|
2032
2165
|
}
|
|
2033
2166
|
}));
|
|
2034
|
-
const restartStudioApp = toolkit.createAsyncThunk('studio/restartStudioApp', ({ idApp }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2167
|
+
const restartStudioApp = toolkit.createAsyncThunk('studio/restartStudioApp', ({ idApp }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2035
2168
|
const jApi = extra.jApi;
|
|
2036
2169
|
try {
|
|
2037
2170
|
yield jApi.application.restart(idApp);
|
|
2171
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Restarted' }));
|
|
2038
2172
|
}
|
|
2039
2173
|
catch (_) {
|
|
2174
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2040
2175
|
throw rejectWithValue({ error: 1, errorMsg: 'Error restarting application' });
|
|
2041
2176
|
}
|
|
2042
2177
|
}));
|
|
2043
|
-
const cloneStudioApp = toolkit.createAsyncThunk('studio/cloneStudioApp', ({ idApp }, { extra, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2044
|
-
var
|
|
2178
|
+
const cloneStudioApp = toolkit.createAsyncThunk('studio/cloneStudioApp', ({ idApp }, { extra, getState, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2179
|
+
var _b;
|
|
2045
2180
|
const jApi = extra.jApi;
|
|
2046
2181
|
const existingStudioApp = getState().studio.studioAppsList.studioAppsList.find((app) => app.idApp === idApp);
|
|
2047
2182
|
if (!existingStudioApp)
|
|
2048
2183
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
2049
|
-
const currentUser = (
|
|
2184
|
+
const currentUser = (_b = getState().userCurrent) === null || _b === void 0 ? void 0 : _b.uri;
|
|
2050
2185
|
const [clonedStudioApp, newAppId] = cloneStudioAppFromExistingApp(existingStudioApp, currentUser);
|
|
2051
2186
|
const clonedStudioAppReady = JSON.stringify(clonedStudioApp);
|
|
2052
2187
|
try {
|
|
2053
2188
|
yield jApi.application.save(newAppId, clonedStudioAppReady, 'saved');
|
|
2189
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Cloned' }));
|
|
2054
2190
|
return clonedStudioApp;
|
|
2055
2191
|
}
|
|
2056
2192
|
catch (_) {
|
|
2193
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2057
2194
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
2058
2195
|
}
|
|
2059
2196
|
}));
|
|
@@ -2160,29 +2297,51 @@ const StudioAppsListSlice = toolkit.createSlice({
|
|
|
2160
2297
|
.addCase(cloneStudioApp.rejected, (state) => {
|
|
2161
2298
|
if (state.cloneStudioAppStatus === 'pending')
|
|
2162
2299
|
state.cloneStudioAppStatus = 'idle';
|
|
2300
|
+
})
|
|
2301
|
+
.addCase(createNewStudioApp.pending, (state) => {
|
|
2302
|
+
if (state.createNewStudioAppStatus === 'idle')
|
|
2303
|
+
state.createNewStudioAppStatus = 'pending';
|
|
2304
|
+
})
|
|
2305
|
+
.addCase(createNewStudioApp.fulfilled, (state, action) => {
|
|
2306
|
+
if (state.createNewStudioAppStatus === 'pending') {
|
|
2307
|
+
state.createNewStudioAppStatus = 'idle';
|
|
2308
|
+
}
|
|
2309
|
+
state.studioAppsList = [...state.studioAppsList, action.payload];
|
|
2310
|
+
})
|
|
2311
|
+
.addCase(createNewStudioApp.rejected, (state) => {
|
|
2312
|
+
if (state.createNewStudioAppStatus === 'pending')
|
|
2313
|
+
state.createNewStudioAppStatus = 'idle';
|
|
2163
2314
|
});
|
|
2164
2315
|
},
|
|
2165
2316
|
});
|
|
2166
2317
|
|
|
2167
2318
|
const joinedReducers = redux.combineReducers({
|
|
2168
2319
|
[StudioAppsListSlice.name]: StudioAppsListSlice.reducer,
|
|
2320
|
+
[CurrentStudioAppSlice.name]: CurrentStudioAppSlice.reducer,
|
|
2169
2321
|
});
|
|
2170
|
-
|
|
2322
|
+
function selectStudioAppsList(state) {
|
|
2171
2323
|
return state.studio.studioAppsList;
|
|
2172
|
-
}
|
|
2324
|
+
}
|
|
2325
|
+
function selectCurrentStudioApp(state) {
|
|
2326
|
+
return state.studio.currentStudioApp;
|
|
2327
|
+
}
|
|
2173
2328
|
const studioSlice = {
|
|
2174
2329
|
name: 'studio',
|
|
2175
2330
|
reducer: joinedReducers,
|
|
2176
2331
|
};
|
|
2177
2332
|
const studio = {
|
|
2178
2333
|
slice: studioSlice,
|
|
2179
|
-
actions: Object.assign(Object.assign({}, StudioAppsListSlice.actions), { fetchStudioAppsList,
|
|
2334
|
+
actions: Object.assign(Object.assign(Object.assign({}, StudioAppsListSlice.actions), CurrentStudioAppSlice.actions), { fetchStudioAppsList,
|
|
2180
2335
|
deleteStudioApp,
|
|
2181
2336
|
suspendStudioApp,
|
|
2182
2337
|
restartStudioApp,
|
|
2183
|
-
cloneStudioApp
|
|
2338
|
+
cloneStudioApp,
|
|
2339
|
+
createNewStudioApp,
|
|
2340
|
+
fetchCurrentStudioApp,
|
|
2341
|
+
saveCurrentStudioApp }),
|
|
2184
2342
|
selectors: {
|
|
2185
2343
|
selectStudioAppsList,
|
|
2344
|
+
selectCurrentStudioApp,
|
|
2186
2345
|
},
|
|
2187
2346
|
};
|
|
2188
2347
|
|