Make changes according to figma in UI

Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>
This commit is contained in:
sagargurung1001@gmail.com 2023-06-07 16:44:50 +05:45
Родитель 635841f567
Коммит fc01aaec21
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 8B559546DF111B3C
5 изменённых файлов: 50 добавлений и 27 удалений

Просмотреть файл

@ -917,7 +917,7 @@ class OpenProjectAPIService {
public function isSystemReadyForProjectFolderSetUp(): bool {
if ($this->userManager->userExists(Application::OPEN_PROJECT_ENTITIES_NAME) && $this->groupManager->groupExists(Application::OPEN_PROJECT_ENTITIES_NAME)) {
if (!$this->isGroupfoldersAppEnabled()) {
throw new \Exception('The group folder app is not installed');
throw new \Exception('The "Group folders" app is not installed');
}
}
if ($this->userManager->userExists(Application::OPEN_PROJECT_ENTITIES_NAME)) {
@ -925,12 +925,12 @@ class OpenProjectAPIService {
} elseif ($this->groupManager->groupExists(Application::OPEN_PROJECT_ENTITIES_NAME)) {
throw new OpenprojectGroupfolderSetupConflictException('The group "'. Application::OPEN_PROJECT_ENTITIES_NAME .'" already exists');
} elseif (!$this->isGroupfoldersAppEnabled()) {
throw new \Exception('The group folder app is not installed');
throw new \Exception('The "Group folders" app is not installed');
} elseif ($this->isOpenProjectGroupfolderCreated()) {
throw new OpenprojectGroupfolderSetupConflictException(
'The group folder name "' .
Application::OPEN_PROJECT_ENTITIES_NAME .
'" integration already exists'
'" already exists'
);
}
return true;

Просмотреть файл

@ -381,8 +381,8 @@ export default {
server: false, opOauth: false, ncOauth: false, opUserAppPassword: false, projectFolderSetUp: false,
},
buttonTextLabel: {
keepCurrentChange: t('integration_openproject', 'Keep current change'),
completeWithoutProjectFolderSetup: t('integration_openproject', 'Complete without group folder setup'),
keepCurrentChange: t('integration_openproject', 'Keep current setup'),
completeWithoutProjectFolderSetup: t('integration_openproject', 'Complete without project folder'),
completeWithProjectFolderSetup: t('integration_openproject', 'Setup OpenProject user, group and folder'),
},
loadingServerHostForm: false,
@ -502,6 +502,11 @@ export default {
const htmlLink = `<a class="link" href="${this.adminFileStorageHref}" target="_blank" title="${linkText}">${linkText}</a>`
return t('integration_openproject', 'This value is only visible now and then never again. Copy this password to OpenProject {htmlLink} as an Administrator.', { htmlLink }, null, { escape: false, sanitize: false })
},
errorHintForGroupFolderNameAlreadyExists() {
const linkText = t('integration_openproject', 'troubleshooting guide')
const htmlLink = `<a class="link" href="/404" target="_blank" title="${linkText}">${linkText}</a>`
return t('integration_openproject', 'Setting up the OpenProject user, group and group folder was not possible. Please check this {htmlLink} on how to resolve this situation.', { htmlLink }, null, { escape: false, sanitize: false })
},
isIntegrationComplete() {
return (this.isServerHostFormComplete
&& this.isOPOAuthFormComplete
@ -580,10 +585,10 @@ export default {
},
projectFolderSetUpErrorMessageDescription(errorKey) {
switch (errorKey) {
case 'The group folder name "OpenProject" integration already exists' :
return t('integration_openproject', 'Please make sure to rename the group folder or completely delete the previous one or deactivate the automatically managed folders.')
case 'The group folder app is not installed' :
return t('integration_openproject', 'Please install the group folder to be able to use automatic managed folders or deactivate the automatically managed folders.')
case 'The group folder name "OpenProject" already exists' :
return this.errorHintForGroupFolderNameAlreadyExists
case 'The "Group folders" app is not installed' :
return t('integration_openproject', 'Please install the "Group folders" to be able to use automatic managed folders or deactivate the automatically managed folders.')
case 'The user "OpenProject" already exists' :
return t('integration_openproject', 'Please make sure to completely delete the previous user or deactivate the automatically managed folders.')
case 'The group "OpenProject" already exists' :

Просмотреть файл

@ -4,12 +4,13 @@
<AlertCircleOutline fill-color="#FF0000" :size="26" />
<b class="project-folder-error-alert-message">{{ projectFolderSetUpError }}</b>
</div>
<p>{{ projectFolderSetUpErrorMessageDescription }}</p>
<p v-html="sanitizedHintText" /> <!-- eslint-disable-line vue/no-v-html -->
</div>
</template>
<script>
import AlertCircleOutline from 'vue-material-design-icons/AlertCircleOutline.vue'
import dompurify from 'dompurify'
export default {
name: 'ProjectFolderError',
components: {
@ -25,6 +26,11 @@ export default {
required: true,
},
},
computed: {
sanitizedHintText() {
return dompurify.sanitize(this.projectFolderSetUpErrorMessageDescription, { ADD_ATTR: ['target'] })
},
},
}
</script>
<style lang="scss" scoped>
@ -42,3 +48,10 @@ export default {
color: var(--color-error);
}
</style>
<style>
.project-folder-error .link {
color: #1a67a3 !important;
font-style: italic;
}
</style>

Просмотреть файл

@ -885,7 +885,7 @@ describe('AdminSettings.vue', () => {
await projectFolderSetupSwitchButton.trigger('click')
expect(wrapper.vm.isProjectFolderSwitchEnabled).toBe(false)
const completeWithoutProjectFolderSetupButton = wrapper.find(selectors.completeWithoutProjectFolderSetupButton)
expect(completeWithoutProjectFolderSetupButton.text()).toBe('Complete without group folder setup')
expect(completeWithoutProjectFolderSetupButton.text()).toBe('Complete without project folder')
})
describe('on trigger "Complete without group folder setup"', () => {
@ -929,7 +929,7 @@ describe('AdminSettings.vue', () => {
await projectFolderSetupSwitchButton.trigger('click')
await wrapper.vm.$nextTick()
const completeWithoutProjectFolderSetupButton = wrapper.find(selectors.completeWithoutProjectFolderSetupButton)
expect(completeWithoutProjectFolderSetupButton.text()).toBe('Complete without group folder setup')
expect(completeWithoutProjectFolderSetupButton.text()).toBe('Complete without project folder')
await completeWithoutProjectFolderSetupButton.trigger('click')
await wrapper.vm.$nextTick()
expect(saveOPOptionsSpy).toBeCalledWith(
@ -969,10 +969,10 @@ describe('AdminSettings.vue', () => {
describe('upon failure', () => {
it.each([
[
'should set the project folder error message and error details when group folder app is not enabled',
'should set the project folder error message and error details when group folders app is not enabled',
{
error: 'The group folder app is not installed',
expectedErrorDetailsMessage: 'Please install the group folder to be able to use automatic managed folders or deactivate the automatically managed folders.',
error: 'The "Group folders" app is not installed',
expectedErrorDetailsMessage: 'Please install the "Group folders" to be able to use automatic managed folders or deactivate the automatically managed folders.',
},
],
[
@ -985,8 +985,8 @@ describe('AdminSettings.vue', () => {
[
'should set the group folder name already exists error message and error details when group folder already exists',
{
error: 'The group folder name "OpenProject" integration already exists',
expectedErrorDetailsMessage: 'Please make sure to rename the group folder or completely delete the previous one or deactivate the automatically managed folders.',
error: 'The group folder name "OpenProject" already exists',
expectedErrorDetailsMessage: 'Setting up the OpenProject user, group and group folder was not possible. Please check this troubleshooting guide on how to resolve this situation.',
},
],
[
@ -1037,6 +1037,11 @@ describe('AdminSettings.vue', () => {
const saveOPOptionsSpy = jest.spyOn(axios, 'put')
.mockImplementationOnce(() => Promise.reject(err))
if (expectedErrorDetails.error === 'The group folder name "OpenProject" already exists') {
jest.spyOn(wrapper.vm, 'projectFolderSetUpErrorMessageDescription').mockReturnValue(
'Setting up the OpenProject user, group and group folder was not possible. Please check this troubleshooting guide on how to resolve this situation.'
)
}
const completeProjectFolderSetupWithGroupFolderButton = wrapper.find(selectors.completeProjectFolderSetupWithGroupFolderButton)
await completeProjectFolderSetupWithGroupFolderButton.trigger('click')
await wrapper.vm.$nextTick()
@ -1248,7 +1253,7 @@ describe('AdminSettings.vue', () => {
it('should set the button label to "keep current change"', async () => {
const completeWithoutProjectFolderSetupButton = wrapper.find(selectors.completeWithoutProjectFolderSetupButton)
expect(completeWithoutProjectFolderSetupButton.text()).toBe('Keep current change')
expect(completeWithoutProjectFolderSetupButton.text()).toBe('Keep current setup')
})
it('should show button label to "Setup OpenProject user, group and folder" when switch is "On"', async () => {
@ -1303,12 +1308,12 @@ describe('AdminSettings.vue', () => {
it('should show button label to "keep current"', async () => {
const completeProjectFolderSetupWithGroupFolderButton = wrapper.find(selectors.completeProjectFolderSetupWithGroupFolderButton)
expect(completeProjectFolderSetupWithGroupFolderButton.text()).toBe('Keep current change')
expect(completeProjectFolderSetupWithGroupFolderButton.text()).toBe('Keep current setup')
})
it('should not create new user app password on trigger "Keep on current change"', async () => {
const completeProjectFolderSetupWithGroupFolderButton = wrapper.find(selectors.completeProjectFolderSetupWithGroupFolderButton)
expect(completeProjectFolderSetupWithGroupFolderButton.text()).toBe('Keep current change')
expect(completeProjectFolderSetupWithGroupFolderButton.text()).toBe('Keep current setup')
completeProjectFolderSetupWithGroupFolderButton.trigger('click')
expect(getgroupfolderStatusSpy).toBeCalledTimes(1)
expect(wrapper.vm.oPUserAppPassword).toBe('opUserPassword')
@ -1318,7 +1323,7 @@ describe('AdminSettings.vue', () => {
const projectFolderSetupSwitchButton = wrapper.find(selectors.projectFolderSetupSwitch)
await projectFolderSetupSwitchButton.trigger('click')
const completeWithoutProjectFolderSetupButton = wrapper.find(selectors.completeWithoutProjectFolderSetupButton)
expect(completeWithoutProjectFolderSetupButton.text()).toBe('Complete without group folder setup')
expect(completeWithoutProjectFolderSetupButton.text()).toBe('Complete without project folder')
})
it('should set switch as "on" again (same as fresh set up) when completely reset', async () => {
@ -1420,10 +1425,10 @@ describe('AdminSettings.vue', () => {
})
it.each([
[
'should set the project folder error message and error details when group folder app is not enabled',
'should set the project folder error message and error details when group folders app is not enabled',
{
error: 'The group folder app is not installed',
expectedErrorDetailsMessage: 'Please install the group folder to be able to use automatic managed folders or deactivate the automatically managed folders.',
error: 'The "Group folders" app is not installed',
expectedErrorDetailsMessage: 'Please install the "Group folders" to be able to use automatic managed folders or deactivate the automatically managed folders.',
},
],
[

Просмотреть файл

@ -1679,11 +1679,11 @@ class OpenProjectAPIServiceTest extends TestCase {
*/
public function isSystemReadyForGroupFolderSetUpUserOrGroupExistsExceptionDataProvider(): array {
return [
[true, true, false, false,'The group folder app is not installed'],
[true, true, false, false,'The "Group folders" app is not installed'],
[true, false, false, false,'The user "'. Application::OPEN_PROJECT_ENTITIES_NAME .'" already exists'],
[false, true, false, false,'The group "'. Application::OPEN_PROJECT_ENTITIES_NAME .'" already exists'],
[false, false, false, false,'The group folder app is not installed'],
[false, false, true, true,'The group folder name "'. Application::OPEN_PROJECT_ENTITIES_NAME .'" integration already exists'],
[false, false, false, false,'The "Group folders" app is not installed'],
[false, false, true, true,'The group folder name "'. Application::OPEN_PROJECT_ENTITIES_NAME .'" already exists'],
];
}