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/esm.js
CHANGED
|
@@ -60,7 +60,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
const initialState$
|
|
63
|
+
const initialState$h = {
|
|
64
64
|
entities: [],
|
|
65
65
|
loading: 'idle',
|
|
66
66
|
nbResults: 0,
|
|
@@ -71,7 +71,7 @@ const fetchBookableAsset = createAsyncThunk('BookableAsset/fetchBookableAsset',
|
|
|
71
71
|
}));
|
|
72
72
|
const BookableAssetSlice = createSlice({
|
|
73
73
|
name: 'bookableAsset',
|
|
74
|
-
initialState: initialState$
|
|
74
|
+
initialState: initialState$h,
|
|
75
75
|
reducers: {},
|
|
76
76
|
extraReducers: (builder) => {
|
|
77
77
|
builder
|
|
@@ -92,7 +92,7 @@ const BookableAssetSlice = createSlice({
|
|
|
92
92
|
const fetchConfiguration = createAsyncThunk('AssetReservation/configuration', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
93
93
|
return yield extra.jApi.assetReservation.configuration();
|
|
94
94
|
}));
|
|
95
|
-
const initialState$
|
|
95
|
+
const initialState$g = {
|
|
96
96
|
description: '',
|
|
97
97
|
right: {
|
|
98
98
|
manage: false,
|
|
@@ -106,7 +106,7 @@ const initialState$f = {
|
|
|
106
106
|
};
|
|
107
107
|
const AssetReservationConfigurationSlice = createSlice({
|
|
108
108
|
name: 'configuration',
|
|
109
|
-
initialState: initialState$
|
|
109
|
+
initialState: initialState$g,
|
|
110
110
|
reducers: {},
|
|
111
111
|
extraReducers: (builder) => {
|
|
112
112
|
builder
|
|
@@ -127,7 +127,7 @@ const initForm = {
|
|
|
127
127
|
hourStart: '',
|
|
128
128
|
hourEnd: '',
|
|
129
129
|
};
|
|
130
|
-
const initialState$
|
|
130
|
+
const initialState$f = {
|
|
131
131
|
entities: [],
|
|
132
132
|
loading: 'idle',
|
|
133
133
|
nbResults: 0,
|
|
@@ -139,7 +139,7 @@ const fetchReservation = createAsyncThunk('Reservation/fetchReservation', (viewM
|
|
|
139
139
|
}));
|
|
140
140
|
const ReservationSlice = createSlice({
|
|
141
141
|
name: 'reservation',
|
|
142
|
-
initialState: initialState$
|
|
142
|
+
initialState: initialState$f,
|
|
143
143
|
reducers: {
|
|
144
144
|
setForm: (state, action) => {
|
|
145
145
|
state.form = action.payload;
|
|
@@ -232,7 +232,7 @@ const Toast = {
|
|
|
232
232
|
selectors: selectors$1,
|
|
233
233
|
};
|
|
234
234
|
|
|
235
|
-
const initialState$
|
|
235
|
+
const initialState$e = {
|
|
236
236
|
bookmarks: [],
|
|
237
237
|
loading: 'idle',
|
|
238
238
|
status: undefined,
|
|
@@ -295,7 +295,7 @@ const deleteBookmark = createAsyncThunk('bookmarkList/deleteBookmark', (bookmark
|
|
|
295
295
|
}));
|
|
296
296
|
const BookmarkListSlice = createSlice({
|
|
297
297
|
name: 'bookmarkList',
|
|
298
|
-
initialState: initialState$
|
|
298
|
+
initialState: initialState$e,
|
|
299
299
|
reducers: {
|
|
300
300
|
resetAddBookmarkStatus: (state, action) => {
|
|
301
301
|
if (state.add[action.payload]) {
|
|
@@ -458,7 +458,7 @@ const getRTHandlers = function (dispatch) {
|
|
|
458
458
|
];
|
|
459
459
|
};
|
|
460
460
|
|
|
461
|
-
const initialState$
|
|
461
|
+
const initialState$d = {
|
|
462
462
|
bookmark: undefined,
|
|
463
463
|
status: undefined,
|
|
464
464
|
loading: 'idle',
|
|
@@ -480,7 +480,7 @@ const editBookmark = createAsyncThunk('bookmarkEdit/editBookmark', (bookmark, {
|
|
|
480
480
|
}));
|
|
481
481
|
const BookmarkEditSlice = createSlice({
|
|
482
482
|
name: 'bookmarkEdit',
|
|
483
|
-
initialState: initialState$
|
|
483
|
+
initialState: initialState$d,
|
|
484
484
|
reducers: {
|
|
485
485
|
setEditBookmark: (state, action) => {
|
|
486
486
|
state.bookmark = Object.assign({}, action.payload);
|
|
@@ -533,7 +533,7 @@ const Bookmark = {
|
|
|
533
533
|
getRTHandlers: getRTHandlers,
|
|
534
534
|
};
|
|
535
535
|
|
|
536
|
-
const initialState$
|
|
536
|
+
const initialState$c = {
|
|
537
537
|
loading: 'idle',
|
|
538
538
|
access: { createCategory: false },
|
|
539
539
|
};
|
|
@@ -561,7 +561,7 @@ const fetchFaqConfig = createAsyncThunk('faqConfig/fetch', () => __awaiter(void
|
|
|
561
561
|
}));
|
|
562
562
|
const FaqConfigSlice = createSlice({
|
|
563
563
|
name: 'config',
|
|
564
|
-
initialState: initialState$
|
|
564
|
+
initialState: initialState$c,
|
|
565
565
|
reducers: {},
|
|
566
566
|
extraReducers: (builder) => {
|
|
567
567
|
builder
|
|
@@ -593,7 +593,7 @@ const FaqConfigSlice = createSlice({
|
|
|
593
593
|
},
|
|
594
594
|
});
|
|
595
595
|
|
|
596
|
-
const initialState$
|
|
596
|
+
const initialState$b = {
|
|
597
597
|
loading: 'idle',
|
|
598
598
|
categories: null,
|
|
599
599
|
};
|
|
@@ -605,7 +605,7 @@ const fetchFaqCategories = createAsyncThunk('faqCategories/fetch', () => __await
|
|
|
605
605
|
}));
|
|
606
606
|
const FaqCategoriesSlice = createSlice({
|
|
607
607
|
name: 'categories',
|
|
608
|
-
initialState: initialState$
|
|
608
|
+
initialState: initialState$b,
|
|
609
609
|
reducers: {},
|
|
610
610
|
extraReducers: (builder) => {
|
|
611
611
|
builder
|
|
@@ -887,7 +887,7 @@ const initialMap = {
|
|
|
887
887
|
illustration: '',
|
|
888
888
|
assignLicense: false,
|
|
889
889
|
};
|
|
890
|
-
const initialState$
|
|
890
|
+
const initialState$a = {
|
|
891
891
|
map: Object.assign({}, initialMap),
|
|
892
892
|
loading: 'idle',
|
|
893
893
|
status: undefined,
|
|
@@ -931,13 +931,13 @@ const createMap = createAsyncThunk('mapCreate/create', ({ map, jlandUrlBase }, {
|
|
|
931
931
|
}));
|
|
932
932
|
const MapCreateSlice = createSlice({
|
|
933
933
|
name: 'mapCreate',
|
|
934
|
-
initialState: initialState$
|
|
934
|
+
initialState: initialState$a,
|
|
935
935
|
reducers: {
|
|
936
936
|
setMap: (state, action) => {
|
|
937
937
|
state.map = action.payload;
|
|
938
938
|
},
|
|
939
939
|
resetCreateMapState: () => {
|
|
940
|
-
return initialState$
|
|
940
|
+
return initialState$a;
|
|
941
941
|
},
|
|
942
942
|
},
|
|
943
943
|
extraReducers: (builder) => {
|
|
@@ -1024,10 +1024,10 @@ const Model = {
|
|
|
1024
1024
|
selectors: Object.assign(Object.assign({}, selectors), { selectByIds }),
|
|
1025
1025
|
};
|
|
1026
1026
|
|
|
1027
|
-
const initialState$
|
|
1027
|
+
const initialState$9 = {};
|
|
1028
1028
|
const NetworkStaticsSlice = createSlice({
|
|
1029
1029
|
name: 'statics',
|
|
1030
|
-
initialState: initialState$
|
|
1030
|
+
initialState: initialState$9,
|
|
1031
1031
|
reducers: {
|
|
1032
1032
|
initNetworkStatics: (_, { payload }) => {
|
|
1033
1033
|
return payload;
|
|
@@ -1083,7 +1083,7 @@ const fetchRecentFiles = createAsyncThunk('/fetchRecentFiles', (_, { extra, getS
|
|
|
1083
1083
|
return yield jApi.wedoc.getFiles(Object.assign(Object.assign({}, initialQuery), { filters, limit: 4 }));
|
|
1084
1084
|
}));
|
|
1085
1085
|
|
|
1086
|
-
const initialState$
|
|
1086
|
+
const initialState$8 = {
|
|
1087
1087
|
entities: [],
|
|
1088
1088
|
nbEntities: 0,
|
|
1089
1089
|
entitiesRecent: [],
|
|
@@ -1095,7 +1095,7 @@ const initialState$7 = {
|
|
|
1095
1095
|
};
|
|
1096
1096
|
const WedocAppSlice = createSlice({
|
|
1097
1097
|
name: 'wedoc',
|
|
1098
|
-
initialState: initialState$
|
|
1098
|
+
initialState: initialState$8,
|
|
1099
1099
|
reducers: {
|
|
1100
1100
|
update: (state, action) => {
|
|
1101
1101
|
state.entities = [
|
|
@@ -1168,14 +1168,14 @@ const fetchRequest = createAsyncThunk('/fetchRequest', ({ uri, idUser }, { extra
|
|
|
1168
1168
|
return yield jApi.wedoc.getAccessRequest(uri, idUser);
|
|
1169
1169
|
}));
|
|
1170
1170
|
|
|
1171
|
-
const initialState$
|
|
1171
|
+
const initialState$7 = {
|
|
1172
1172
|
entities: [],
|
|
1173
1173
|
nbEntities: 0,
|
|
1174
1174
|
loading: 'idle',
|
|
1175
1175
|
};
|
|
1176
1176
|
const ShareSlice = createSlice({
|
|
1177
1177
|
name: 'share',
|
|
1178
|
-
initialState: initialState$
|
|
1178
|
+
initialState: initialState$7,
|
|
1179
1179
|
reducers: {
|
|
1180
1180
|
remove: (state, action) => {
|
|
1181
1181
|
state.entities = [
|
|
@@ -1213,7 +1213,7 @@ const Share = {
|
|
|
1213
1213
|
},
|
|
1214
1214
|
};
|
|
1215
1215
|
|
|
1216
|
-
const initialState$
|
|
1216
|
+
const initialState$6 = {
|
|
1217
1217
|
channels: undefined,
|
|
1218
1218
|
loading: 'idle',
|
|
1219
1219
|
loadingChannelDeletion: 'idle',
|
|
@@ -1256,7 +1256,7 @@ const deleteChannel = createAsyncThunk('/deleteChannel', ({ channel }, { extra,
|
|
|
1256
1256
|
}));
|
|
1257
1257
|
const ChannelsListSlice = createSlice({
|
|
1258
1258
|
name: 'channelsList',
|
|
1259
|
-
initialState: Object.assign({}, initialState$
|
|
1259
|
+
initialState: Object.assign({}, initialState$6),
|
|
1260
1260
|
reducers: {},
|
|
1261
1261
|
extraReducers: (builder) => {
|
|
1262
1262
|
builder
|
|
@@ -1325,10 +1325,10 @@ const TVDisplay = {
|
|
|
1325
1325
|
},
|
|
1326
1326
|
};
|
|
1327
1327
|
|
|
1328
|
-
const initialState$
|
|
1328
|
+
const initialState$5 = {};
|
|
1329
1329
|
const TinyMCEOptionsSlice = createSlice({
|
|
1330
1330
|
name: 'options',
|
|
1331
|
-
initialState: initialState$
|
|
1331
|
+
initialState: initialState$5,
|
|
1332
1332
|
reducers: {
|
|
1333
1333
|
initOptions: (_, { payload }) => {
|
|
1334
1334
|
return { common: payload };
|
|
@@ -1354,7 +1354,7 @@ const TinyMCE = {
|
|
|
1354
1354
|
},
|
|
1355
1355
|
};
|
|
1356
1356
|
|
|
1357
|
-
const initialState$
|
|
1357
|
+
const initialState$4 = {
|
|
1358
1358
|
id: 0,
|
|
1359
1359
|
mainType: 'user',
|
|
1360
1360
|
type: 'user',
|
|
@@ -1368,7 +1368,7 @@ const initialState$3 = {
|
|
|
1368
1368
|
};
|
|
1369
1369
|
const slice = createSlice({
|
|
1370
1370
|
name: 'userCurrent',
|
|
1371
|
-
initialState: initialState$
|
|
1371
|
+
initialState: initialState$4,
|
|
1372
1372
|
reducers: {
|
|
1373
1373
|
init: (_, { payload }) => {
|
|
1374
1374
|
return payload;
|
|
@@ -1586,7 +1586,7 @@ function widgetDefinition(name) {
|
|
|
1586
1586
|
|
|
1587
1587
|
const MODE_EDIT = 'edit';
|
|
1588
1588
|
const MODE_VIEW = 'view';
|
|
1589
|
-
const initialState$
|
|
1589
|
+
const initialState$3 = {
|
|
1590
1590
|
token: undefined,
|
|
1591
1591
|
ids: {},
|
|
1592
1592
|
layers: {},
|
|
@@ -1598,7 +1598,7 @@ const initialState$2 = {
|
|
|
1598
1598
|
};
|
|
1599
1599
|
const widgetsSlice = createSlice({
|
|
1600
1600
|
name: 'widgets',
|
|
1601
|
-
initialState: initialState$
|
|
1601
|
+
initialState: initialState$3,
|
|
1602
1602
|
reducers: {
|
|
1603
1603
|
registerWidget: (state, action) => {
|
|
1604
1604
|
const { uniqid, widget } = action.payload;
|
|
@@ -1740,12 +1740,12 @@ const Widget = {
|
|
|
1740
1740
|
},
|
|
1741
1741
|
};
|
|
1742
1742
|
|
|
1743
|
-
const initialState$
|
|
1743
|
+
const initialState$2 = {
|
|
1744
1744
|
editors: [],
|
|
1745
1745
|
};
|
|
1746
1746
|
const editorsSlice = createSlice({
|
|
1747
1747
|
name: 'editors',
|
|
1748
|
-
initialState: initialState$
|
|
1748
|
+
initialState: initialState$2,
|
|
1749
1749
|
reducers: {
|
|
1750
1750
|
registerEditor: (state, action) => {
|
|
1751
1751
|
const { uniqid, name } = action.payload;
|
|
@@ -1971,6 +1971,85 @@ function serverAppsToStudioApps(serverApps) {
|
|
|
1971
1971
|
return studioApps;
|
|
1972
1972
|
}
|
|
1973
1973
|
|
|
1974
|
+
const initialState$1 = {
|
|
1975
|
+
currentStudioApp: null,
|
|
1976
|
+
fetchCurrentStudioAppStatus: 'idle',
|
|
1977
|
+
saveCurrentStudioAppStatus: 'idle',
|
|
1978
|
+
};
|
|
1979
|
+
const fetchCurrentStudioApp = createAsyncThunk('studio/fetchCurrentStudioApp', ({ idApp, status }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1980
|
+
const jApi = extra.jApi;
|
|
1981
|
+
const error = { error: 1, errorMsg: 'Error fetching application' };
|
|
1982
|
+
try {
|
|
1983
|
+
const studioApplicationBase = (yield jApi.application.get(idApp, status)).result;
|
|
1984
|
+
const studioApplication = serverAppsToStudioApps([studioApplicationBase])[0];
|
|
1985
|
+
if (!studioApplication) {
|
|
1986
|
+
return rejectWithValue(error);
|
|
1987
|
+
}
|
|
1988
|
+
return studioApplication;
|
|
1989
|
+
}
|
|
1990
|
+
catch (_) {
|
|
1991
|
+
return rejectWithValue(error);
|
|
1992
|
+
}
|
|
1993
|
+
}));
|
|
1994
|
+
const saveCurrentStudioApp = createAsyncThunk('studio/saveCurrentStudioApp', (_, { extra, rejectWithValue, getState, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1995
|
+
const jApi = extra.jApi;
|
|
1996
|
+
const error = { error: 1, errorMsg: 'Error saving application' };
|
|
1997
|
+
const currentStudioApp = getState().studio.currentStudioApp.currentStudioApp;
|
|
1998
|
+
if (!currentStudioApp) {
|
|
1999
|
+
return rejectWithValue(error);
|
|
2000
|
+
}
|
|
2001
|
+
const stringifiedApp = JSON.stringify(currentStudioApp);
|
|
2002
|
+
try {
|
|
2003
|
+
yield jApi.application.save(currentStudioApp.idApp, stringifiedApp, 'saved');
|
|
2004
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Edition_Saved' }));
|
|
2005
|
+
return;
|
|
2006
|
+
}
|
|
2007
|
+
catch (_) {
|
|
2008
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2009
|
+
return rejectWithValue(error);
|
|
2010
|
+
}
|
|
2011
|
+
}));
|
|
2012
|
+
const CurrentStudioAppSlice = createSlice({
|
|
2013
|
+
name: 'currentStudioApp',
|
|
2014
|
+
initialState: initialState$1,
|
|
2015
|
+
reducers: {
|
|
2016
|
+
setCurrentApp: (state, action) => {
|
|
2017
|
+
state.currentStudioApp = action.payload;
|
|
2018
|
+
},
|
|
2019
|
+
resetCurrentApp: (state) => {
|
|
2020
|
+
state.currentStudioApp = null;
|
|
2021
|
+
},
|
|
2022
|
+
},
|
|
2023
|
+
extraReducers: (builder) => {
|
|
2024
|
+
builder
|
|
2025
|
+
.addCase(fetchCurrentStudioApp.pending, (state) => {
|
|
2026
|
+
if (state.fetchCurrentStudioAppStatus === 'idle')
|
|
2027
|
+
state.fetchCurrentStudioAppStatus = 'pending';
|
|
2028
|
+
})
|
|
2029
|
+
.addCase(fetchCurrentStudioApp.fulfilled, (state, action) => {
|
|
2030
|
+
if (state.fetchCurrentStudioAppStatus === 'pending')
|
|
2031
|
+
state.fetchCurrentStudioAppStatus = 'idle';
|
|
2032
|
+
state.currentStudioApp = action.payload;
|
|
2033
|
+
})
|
|
2034
|
+
.addCase(fetchCurrentStudioApp.rejected, (state) => {
|
|
2035
|
+
if (state.fetchCurrentStudioAppStatus === 'pending')
|
|
2036
|
+
state.fetchCurrentStudioAppStatus = 'idle';
|
|
2037
|
+
})
|
|
2038
|
+
.addCase(saveCurrentStudioApp.pending, (state) => {
|
|
2039
|
+
if (state.saveCurrentStudioAppStatus === 'idle')
|
|
2040
|
+
state.saveCurrentStudioAppStatus = 'pending';
|
|
2041
|
+
})
|
|
2042
|
+
.addCase(saveCurrentStudioApp.fulfilled, (state) => {
|
|
2043
|
+
if (state.saveCurrentStudioAppStatus === 'pending')
|
|
2044
|
+
state.saveCurrentStudioAppStatus = 'idle';
|
|
2045
|
+
})
|
|
2046
|
+
.addCase(saveCurrentStudioApp.rejected, (state) => {
|
|
2047
|
+
if (state.saveCurrentStudioAppStatus === 'pending')
|
|
2048
|
+
state.saveCurrentStudioAppStatus = 'idle';
|
|
2049
|
+
});
|
|
2050
|
+
},
|
|
2051
|
+
});
|
|
2052
|
+
|
|
1974
2053
|
function cloneStudioAppFromExistingApp(existingApp, author) {
|
|
1975
2054
|
const newApp = existingApp.inWorkVersion
|
|
1976
2055
|
? JSON.parse(JSON.stringify(existingApp.inWorkVersion))
|
|
@@ -1983,6 +2062,37 @@ function cloneStudioAppFromExistingApp(existingApp, author) {
|
|
|
1983
2062
|
return [newApp, newAppId];
|
|
1984
2063
|
}
|
|
1985
2064
|
|
|
2065
|
+
function createNewStudioApp$1({ author, appName }) {
|
|
2066
|
+
const newAppId = v4();
|
|
2067
|
+
return {
|
|
2068
|
+
newAppId,
|
|
2069
|
+
newStudioApp: {
|
|
2070
|
+
idApp: newAppId,
|
|
2071
|
+
status: APP_STATUS_TYPE.DRAFT,
|
|
2072
|
+
author: author || '',
|
|
2073
|
+
manifest: {
|
|
2074
|
+
appShortName: appName,
|
|
2075
|
+
appName: appName,
|
|
2076
|
+
author: author || '',
|
|
2077
|
+
description: '',
|
|
2078
|
+
typeLabel: '',
|
|
2079
|
+
cssColor: '#392994',
|
|
2080
|
+
cssClass: {
|
|
2081
|
+
label: 'star',
|
|
2082
|
+
value: 'star',
|
|
2083
|
+
},
|
|
2084
|
+
version: 0.1,
|
|
2085
|
+
dateCreation: new Date().toISOString(),
|
|
2086
|
+
viewSolr: 'solr',
|
|
2087
|
+
checkAccess: false,
|
|
2088
|
+
accessRightList: '',
|
|
2089
|
+
attrExposed: [],
|
|
2090
|
+
articlesCount: 0,
|
|
2091
|
+
},
|
|
2092
|
+
},
|
|
2093
|
+
};
|
|
2094
|
+
}
|
|
2095
|
+
|
|
1986
2096
|
const initialState = {
|
|
1987
2097
|
studioAppsList: [],
|
|
1988
2098
|
loadingStudioAppsList: 'idle',
|
|
@@ -1990,8 +2100,9 @@ const initialState = {
|
|
|
1990
2100
|
suspendStudioAppStatus: 'idle',
|
|
1991
2101
|
restartStudioAppStatus: 'idle',
|
|
1992
2102
|
cloneStudioAppStatus: 'idle',
|
|
2103
|
+
createNewStudioAppStatus: 'idle',
|
|
1993
2104
|
};
|
|
1994
|
-
const fetchStudioAppsList = createAsyncThunk('studio/appsList', (_, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2105
|
+
const fetchStudioAppsList = createAsyncThunk('studio/appsList', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1995
2106
|
const jApi = extra.jApi;
|
|
1996
2107
|
try {
|
|
1997
2108
|
const { result } = yield jApi.application.list();
|
|
@@ -2002,50 +2113,76 @@ const fetchStudioAppsList = createAsyncThunk('studio/appsList', (_, { extra, rej
|
|
|
2002
2113
|
})));
|
|
2003
2114
|
}
|
|
2004
2115
|
catch (_) {
|
|
2005
|
-
|
|
2116
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2117
|
+
throw rejectWithValue({ error: 1, errorMsg: 'Error retrieving applications' });
|
|
2118
|
+
}
|
|
2119
|
+
}));
|
|
2120
|
+
const createNewStudioApp = createAsyncThunk('studio/createApp', ({ appName }, { extra, dispatch, rejectWithValue, getState }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2121
|
+
var _a;
|
|
2122
|
+
const jApi = extra.jApi;
|
|
2123
|
+
const author = (_a = getState().userCurrent) === null || _a === void 0 ? void 0 : _a.uri;
|
|
2124
|
+
const { newAppId, newStudioApp } = createNewStudioApp$1(Object.assign({ appName }, (author && { author })));
|
|
2125
|
+
try {
|
|
2126
|
+
yield jApi.application.save(newAppId, JSON.stringify(newStudioApp), 'saved');
|
|
2127
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Created' }));
|
|
2128
|
+
dispatch(CurrentStudioAppSlice.actions.setCurrentApp(newStudioApp));
|
|
2129
|
+
return newStudioApp;
|
|
2130
|
+
}
|
|
2131
|
+
catch (_) {
|
|
2132
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2133
|
+
throw rejectWithValue({ error: 1, errorMsg: 'Error creating application' });
|
|
2006
2134
|
}
|
|
2007
2135
|
}));
|
|
2008
|
-
const deleteStudioApp = createAsyncThunk('studio/deleteApp', ({ idApp, status }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2136
|
+
const deleteStudioApp = createAsyncThunk('studio/deleteApp', ({ idApp, status }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2009
2137
|
const jApi = extra.jApi;
|
|
2010
2138
|
try {
|
|
2011
|
-
|
|
2139
|
+
const deleteRes = yield jApi.application.delete(idApp, status);
|
|
2140
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Deleted' }));
|
|
2141
|
+
return deleteRes;
|
|
2012
2142
|
}
|
|
2013
2143
|
catch (_) {
|
|
2144
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2014
2145
|
return rejectWithValue({ error: 1, errorMsg: 'Error deleting application' });
|
|
2015
2146
|
}
|
|
2016
2147
|
}));
|
|
2017
|
-
const suspendStudioApp = createAsyncThunk('studio/suspendStudioApp', ({ idApp }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2148
|
+
const suspendStudioApp = createAsyncThunk('studio/suspendStudioApp', ({ idApp }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2018
2149
|
const jApi = extra.jApi;
|
|
2019
2150
|
try {
|
|
2020
2151
|
yield jApi.application.suspend(idApp);
|
|
2152
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Suspended' }));
|
|
2021
2153
|
}
|
|
2022
2154
|
catch (_) {
|
|
2155
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2023
2156
|
throw rejectWithValue({ error: 1, errorMsg: 'Error suspending application' });
|
|
2024
2157
|
}
|
|
2025
2158
|
}));
|
|
2026
|
-
const restartStudioApp = createAsyncThunk('studio/restartStudioApp', ({ idApp }, { extra, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2159
|
+
const restartStudioApp = createAsyncThunk('studio/restartStudioApp', ({ idApp }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2027
2160
|
const jApi = extra.jApi;
|
|
2028
2161
|
try {
|
|
2029
2162
|
yield jApi.application.restart(idApp);
|
|
2163
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Restarted' }));
|
|
2030
2164
|
}
|
|
2031
2165
|
catch (_) {
|
|
2166
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2032
2167
|
throw rejectWithValue({ error: 1, errorMsg: 'Error restarting application' });
|
|
2033
2168
|
}
|
|
2034
2169
|
}));
|
|
2035
|
-
const cloneStudioApp = createAsyncThunk('studio/cloneStudioApp', ({ idApp }, { extra, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2036
|
-
var
|
|
2170
|
+
const cloneStudioApp = createAsyncThunk('studio/cloneStudioApp', ({ idApp }, { extra, getState, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2171
|
+
var _b;
|
|
2037
2172
|
const jApi = extra.jApi;
|
|
2038
2173
|
const existingStudioApp = getState().studio.studioAppsList.studioAppsList.find((app) => app.idApp === idApp);
|
|
2039
2174
|
if (!existingStudioApp)
|
|
2040
2175
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
2041
|
-
const currentUser = (
|
|
2176
|
+
const currentUser = (_b = getState().userCurrent) === null || _b === void 0 ? void 0 : _b.uri;
|
|
2042
2177
|
const [clonedStudioApp, newAppId] = cloneStudioAppFromExistingApp(existingStudioApp, currentUser);
|
|
2043
2178
|
const clonedStudioAppReady = JSON.stringify(clonedStudioApp);
|
|
2044
2179
|
try {
|
|
2045
2180
|
yield jApi.application.save(newAppId, clonedStudioAppReady, 'saved');
|
|
2181
|
+
dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Cloned' }));
|
|
2046
2182
|
return clonedStudioApp;
|
|
2047
2183
|
}
|
|
2048
2184
|
catch (_) {
|
|
2185
|
+
dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
|
|
2049
2186
|
return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
|
|
2050
2187
|
}
|
|
2051
2188
|
}));
|
|
@@ -2152,29 +2289,51 @@ const StudioAppsListSlice = createSlice({
|
|
|
2152
2289
|
.addCase(cloneStudioApp.rejected, (state) => {
|
|
2153
2290
|
if (state.cloneStudioAppStatus === 'pending')
|
|
2154
2291
|
state.cloneStudioAppStatus = 'idle';
|
|
2292
|
+
})
|
|
2293
|
+
.addCase(createNewStudioApp.pending, (state) => {
|
|
2294
|
+
if (state.createNewStudioAppStatus === 'idle')
|
|
2295
|
+
state.createNewStudioAppStatus = 'pending';
|
|
2296
|
+
})
|
|
2297
|
+
.addCase(createNewStudioApp.fulfilled, (state, action) => {
|
|
2298
|
+
if (state.createNewStudioAppStatus === 'pending') {
|
|
2299
|
+
state.createNewStudioAppStatus = 'idle';
|
|
2300
|
+
}
|
|
2301
|
+
state.studioAppsList = [...state.studioAppsList, action.payload];
|
|
2302
|
+
})
|
|
2303
|
+
.addCase(createNewStudioApp.rejected, (state) => {
|
|
2304
|
+
if (state.createNewStudioAppStatus === 'pending')
|
|
2305
|
+
state.createNewStudioAppStatus = 'idle';
|
|
2155
2306
|
});
|
|
2156
2307
|
},
|
|
2157
2308
|
});
|
|
2158
2309
|
|
|
2159
2310
|
const joinedReducers = combineReducers$1({
|
|
2160
2311
|
[StudioAppsListSlice.name]: StudioAppsListSlice.reducer,
|
|
2312
|
+
[CurrentStudioAppSlice.name]: CurrentStudioAppSlice.reducer,
|
|
2161
2313
|
});
|
|
2162
|
-
|
|
2314
|
+
function selectStudioAppsList(state) {
|
|
2163
2315
|
return state.studio.studioAppsList;
|
|
2164
|
-
}
|
|
2316
|
+
}
|
|
2317
|
+
function selectCurrentStudioApp(state) {
|
|
2318
|
+
return state.studio.currentStudioApp;
|
|
2319
|
+
}
|
|
2165
2320
|
const studioSlice = {
|
|
2166
2321
|
name: 'studio',
|
|
2167
2322
|
reducer: joinedReducers,
|
|
2168
2323
|
};
|
|
2169
2324
|
const studio = {
|
|
2170
2325
|
slice: studioSlice,
|
|
2171
|
-
actions: Object.assign(Object.assign({}, StudioAppsListSlice.actions), { fetchStudioAppsList,
|
|
2326
|
+
actions: Object.assign(Object.assign(Object.assign({}, StudioAppsListSlice.actions), CurrentStudioAppSlice.actions), { fetchStudioAppsList,
|
|
2172
2327
|
deleteStudioApp,
|
|
2173
2328
|
suspendStudioApp,
|
|
2174
2329
|
restartStudioApp,
|
|
2175
|
-
cloneStudioApp
|
|
2330
|
+
cloneStudioApp,
|
|
2331
|
+
createNewStudioApp,
|
|
2332
|
+
fetchCurrentStudioApp,
|
|
2333
|
+
saveCurrentStudioApp }),
|
|
2176
2334
|
selectors: {
|
|
2177
2335
|
selectStudioAppsList,
|
|
2336
|
+
selectCurrentStudioApp,
|
|
2178
2337
|
},
|
|
2179
2338
|
};
|
|
2180
2339
|
|