2023-02-02 15:28:06 +00:00
|
|
|
import React, { useState } from 'react';
|
2022-12-29 11:48:24 +00:00
|
|
|
import { appVersionService } from '@/_services';
|
|
|
|
|
import AlertDialog from '@/_ui/AlertDialog';
|
|
|
|
|
import { toast } from 'react-hot-toast';
|
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
|
|
|
|
export const EditVersion = ({
|
|
|
|
|
appId,
|
|
|
|
|
value: editingVersionId,
|
|
|
|
|
setAppVersions,
|
|
|
|
|
setShowEditAppVersion,
|
|
|
|
|
showEditAppVersion,
|
2023-01-05 09:06:39 +00:00
|
|
|
editingVersion,
|
2022-12-29 11:48:24 +00:00
|
|
|
}) => {
|
|
|
|
|
const [isEditingVersion, setIsEditingVersion] = useState(false);
|
2023-01-05 09:06:39 +00:00
|
|
|
const [versionName, setVersionName] = useState(editingVersion?.name || '');
|
2022-12-29 11:48:24 +00:00
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
2023-05-11 07:02:21 +00:00
|
|
|
React.useEffect(() => {
|
|
|
|
|
setVersionName(editingVersion?.name);
|
|
|
|
|
}, [editingVersion?.name]);
|
|
|
|
|
|
2022-12-29 11:48:24 +00:00
|
|
|
const editVersion = () => {
|
|
|
|
|
if (versionName.trim() === '') {
|
2023-01-04 07:58:55 +00:00
|
|
|
toast.error('Version name should not be empty');
|
2022-12-29 11:48:24 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setIsEditingVersion(true);
|
|
|
|
|
appVersionService
|
|
|
|
|
.save(appId, editingVersionId, { name: versionName })
|
|
|
|
|
.then(() => {
|
|
|
|
|
toast.success('Version name updated');
|
|
|
|
|
appVersionService.getAll(appId).then((data) => {
|
|
|
|
|
const versions = data.versions;
|
|
|
|
|
setAppVersions(versions);
|
|
|
|
|
});
|
|
|
|
|
setIsEditingVersion(false);
|
|
|
|
|
setShowEditAppVersion(false);
|
|
|
|
|
})
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
setIsEditingVersion(false);
|
|
|
|
|
toast.error(error?.error);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<AlertDialog
|
|
|
|
|
show={showEditAppVersion}
|
2023-05-11 07:02:21 +00:00
|
|
|
closeModal={() => {
|
|
|
|
|
setVersionName(editingVersion?.name || '');
|
|
|
|
|
setShowEditAppVersion(false);
|
|
|
|
|
}}
|
2022-12-29 11:48:24 +00:00
|
|
|
title={t('editor.appVersionManager.editVersion', 'Edit Version')}
|
Feature Homepage and settings redesign (#5763)
* adding colors
* feat :: add button
* feat :: added typography
* feat: init storybook
* removes browserlist
* feat :: adding button styles and button component
* feat :: added sass addon
* stories update
* feat :: replacing with radix colors
* danger variants
* updates buttin story
* fix :: removing default items
* cleanup
* fix icons update
* feat :: folder list component
* fix :: naming
* icon and split button :: init
* intermediate save :: app card component
* renaming
* updates
* update for module imports
* updates icon
* update :: homepage design updates
* design changes dashboard
* updates :: apps section
* workspace stting new design upate
* updates dasboard design
* style :: fixes
* feat :: added context for sidebar nav breadcrumb
* added all solid icons
* intermediate update
* change: conditions for fetching users
* sorybook updates
* design updates :: workspace settings page
* manage users page
* lint fixes
* fix :: styling
* stle fixes :: workspace settings
* homepage redesign
* fix :: all drawer colors and position ,teplate page revamp , database page header fixes
* imported all bulk icons
* svg to jsx : bulk icons
* minor :: cleanup
* fix :: manage users drawer
* fix :: searchboxes , userspage fixes
* fix :: all inputs and minor ui fixes
* database page ui fixes
* fix :: database and folder search functionality and iconlist in homecard
* fixed some db functionality and edge cases for longer texts
* fix :: user addition manage user page
* self review cleanup and change in bulk icon fill state
* fix :: homepage seacbar
* merging develop and resolving conflicts
* remove unwanted stories
* reverting merge with develop
* Revert "reverting merge with develop"
This reverts commit 2150c8ec0ce9cedda4f4676211faa3321d4af7f8.
* clearing out warnings
* lint fixes
* feat :: added org modal in database page
* fix :: sso loader theme
* fix :: broken styles select
* fixed icon warning and select ui
* fix :: upload bulk and user select dark mode
* merge styles with develop
* feat :: integrated new ui for database
* removing storybook files
* fix :: all bugs related to users dropdown and cleanup
* fix: user search api for organization page
* cleanup and splitting dropzone component
* fix :: overflow issue in app card time
* fix for scrollbars in homepage
* PR review fixes
* updates :: fix d=global datasource design issues , homepage responsiveness
* tj db operations
* breadcrumb bug fixes
* lint fixes
* removing logs , removed fade in in datasource and database page
* marketplace page ui fix
* removing inital users table fetch
* Pr :: review changes
* remove logs
* fix :: popover bug
* minot style fix
* fix :: remove arrow from all popovers
* fix :: for loading states
* ux :: sidebar items reorder
* style :: fix
* style fix :: templates
* fix :: qa bugs
* fix :: Qa reported bugs
* removes :: folder fetch bug
* share link and datsource bg color fix
* fixes :: rename group ,
* removed logs
* pages popover background fix
* fix :: tj db table addition ui bug
* fix :: ui bug confirm modal password disable
* modal , revert name capitalize in lists, typos fix
* typos , users page route bugfix
* users page header bugfix
* workspace archive btn , datasources form style for select
* groups updated , delete, create flow updated
* avatar bug in profile page fix
* revert styles
* fix :: for create new table nav breadcrumb not being updated
* click state bug fix in avatar
* fix bug with appcard popover
* fix :: text capitalize issue
* fix :: lints and updated icon for filter delete
* fix warnings
---------
Co-authored-by: gandharv <gandharvkumargarg@gmail.com>
Co-authored-by: Vijaykant Yadav <vjy239@gmail.com>
2023-04-21 06:15:48 +00:00
|
|
|
checkForBackground={true}
|
2022-12-29 11:48:24 +00:00
|
|
|
>
|
2023-01-05 09:06:39 +00:00
|
|
|
<form
|
|
|
|
|
onSubmit={(e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
editVersion();
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div className="row mb-3">
|
|
|
|
|
<div className="col modal-main">
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
onChange={(e) => setVersionName(e.target.value)}
|
|
|
|
|
className="form-control"
|
2023-03-20 05:13:08 +00:00
|
|
|
data-cy="edit-version-name-input-field"
|
2023-01-05 09:06:39 +00:00
|
|
|
placeholder={t('editor.appVersionManager.enterVersionName', 'Enter version name')}
|
|
|
|
|
disabled={isEditingVersion}
|
|
|
|
|
value={versionName}
|
|
|
|
|
maxLength={25}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2022-12-29 11:48:24 +00:00
|
|
|
</div>
|
2023-01-05 09:06:39 +00:00
|
|
|
<div className="row">
|
|
|
|
|
<div className="col d-flex justify-content-end">
|
2023-03-20 05:13:08 +00:00
|
|
|
<button
|
|
|
|
|
className="btn mx-2"
|
|
|
|
|
data-cy="cancel-button"
|
2023-05-11 07:02:21 +00:00
|
|
|
onClick={() => {
|
|
|
|
|
setVersionName(editingVersion?.name || '');
|
|
|
|
|
setShowEditAppVersion(false);
|
|
|
|
|
}}
|
2023-03-20 05:13:08 +00:00
|
|
|
type="button"
|
|
|
|
|
>
|
2023-01-05 09:06:39 +00:00
|
|
|
{t('globals.cancel', 'Cancel')}
|
|
|
|
|
</button>
|
2023-03-20 05:13:08 +00:00
|
|
|
<button
|
|
|
|
|
className={`btn btn-primary ${isEditingVersion ? 'btn-loading' : ''}`}
|
|
|
|
|
data-cy="save-button"
|
|
|
|
|
type="submit"
|
|
|
|
|
>
|
2023-01-05 09:06:39 +00:00
|
|
|
{t('globals.save', 'Save')}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2022-12-29 11:48:24 +00:00
|
|
|
</div>
|
2023-01-05 09:06:39 +00:00
|
|
|
</form>
|
2022-12-29 11:48:24 +00:00
|
|
|
</AlertDialog>
|
|
|
|
|
);
|
|
|
|
|
};
|