Skip to content

Commit

Permalink
fix: address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
  • Loading branch information
andrey18106 committed Oct 23, 2024
1 parent 615df4f commit 1ef44de
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 30 deletions.
7 changes: 3 additions & 4 deletions apps/settings/src/app-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ export interface IAppstoreApp {
app_api: boolean
active: boolean
internal: boolean
removeable: boolean
removable: boolean
installed: boolean
canInstall: boolean
canUninstall: boolean
canUnInstall: boolean
isCompatible: boolean
needsDownload: boolean
update: string | null
update?: string

appstoreData: Record<string, never>
releases?: IAppstoreAppRelease[]
Expand Down Expand Up @@ -91,5 +91,4 @@ export interface IAppstoreExApp extends IAppstoreApp {
daemon: IDeployDaemon | null | undefined
status: IExAppStatus | Record<string, never>
error: string
removable: boolean
}
4 changes: 2 additions & 2 deletions apps/settings/src/components/AppList/AppDaemonBadge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
</template>

<script setup lang="ts">
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
import { mdiFileChart } from '@mdi/js'
import type { IDeployDaemon } from '../../app-types.ts'
import { mdiFileChart } from '@mdi/js'
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'

defineProps<{
daemon?: IDeployDaemon
Expand Down
22 changes: 14 additions & 8 deletions apps/settings/src/components/AppList/AppItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
class="app-image app-image-icon"
:headers="getDataItemHeaders(`app-table-col-icon`)">
<div v-if="!app?.app_api && shouldDisplayDefaultIcon" class="icon-settings-dark" />
<NcIconSvgWrapper v-else-if="app?.app_api && shouldDisplayDefaultIcon"
:path="mdiCogOutline()"
<NcIconSvgWrapper v-else-if="app.app_api && shouldDisplayDefaultIcon"
:path="mdiCogOutline"
:size="listView ? 24 : 48"
style="min-width: auto; min-height: auto; height: 100%;" />

<svg v-else-if="listView && app.preview && !app?.app_api"
<svg v-else-if="listView && app.preview && !app.app_api"
width="32"
height="32"
viewBox="0 0 32 32">
Expand Down Expand Up @@ -83,7 +83,7 @@
@click.stop="update(app.id)">
{{ t('settings', 'Update to {update}', {update:app.update}) }}
</NcButton>
<NcButton v-if="app.canUnInstall || app.canUninstall"
<NcButton v-if="app.canUnInstall"
class="uninstall"
type="tertiary"
:disabled="installing || isLoading"
Expand Down Expand Up @@ -123,6 +123,8 @@ import SvgFilterMixin from '../SvgFilterMixin.vue'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
import { mdiCogOutline } from '@mdi/js'
import { useAppApiStore } from '../../store/app-api-store'


Check failure on line 128 in apps/settings/src/components/AppList/AppItem.vue

View workflow job for this annotation

GitHub Actions / NPM lint

More than 1 blank line not allowed
export default {
name: 'AppItem',
Expand All @@ -131,7 +133,14 @@ export default {
AppScore,
NcButton,
NcIconSvgWrapper,
mdiCogOutline,
},
setup() {
const appApiStore = useAppApiStore()

return {
appApiStore,
mdiCogOutline,
}
},
mixins: [AppManagement, SvgFilterMixin],
props: {
Expand Down Expand Up @@ -200,9 +209,6 @@ export default {

},
methods: {
mdiCogOutline() {
return mdiCogOutline
},
prefix(prefix, content) {
return prefix + '_' + content
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
:value="t('settings', 'Update to {version}', { version: app.update })"
:disabled="installing || isLoading || isManualInstall"
@click="update(app.id)">
<input v-if="app.canUnInstall || app.canUninstall"
<input v-if="app.canUnInstall"
class="uninstall"
type="button"
:value="t('settings', 'Remove')"
Expand Down Expand Up @@ -81,7 +81,7 @@
<p v-if="!defaultDeployDaemonAccessible" class="warning">
{{ t('settings', 'Default Deploy daemon is not accessible') }}
</p>
<NcCheckboxRadioSwitch v-if="app.canUnInstall || app.canUninstall"
<NcCheckboxRadioSwitch v-if="app.canUnInstall"
:checked="removeData"
:disabled="installing || isLoading || !defaultDeployDaemonAccessible"
@update:checked="toggleRemoveData">
Expand Down Expand Up @@ -113,7 +113,7 @@
<NcDateTime :timestamp="lastModified" />
</div>

<div v-if="appAuthors" class="app-details__section">
<div class="app-details__section">
<h4>
{{ t('settings', 'Author') }}
</h4>
Expand All @@ -122,7 +122,7 @@
</p>
</div>

<div v-if="appCategories" class="app-details__section">
<div class="app-details__section">
<h4>
{{ t('settings', 'Categories') }}
</h4>
Expand Down
6 changes: 0 additions & 6 deletions apps/settings/src/mixins/AppManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ import rebuildNavigation from '../service/rebuild-navigation.js'
import { useAppApiStore } from '../store/app-api-store'

Check failure on line 8 in apps/settings/src/mixins/AppManagement.js

View workflow job for this annotation

GitHub Actions / NPM lint

'useAppApiStore' is defined but never used

Check failure on line 8 in apps/settings/src/mixins/AppManagement.js

View workflow job for this annotation

GitHub Actions / NPM lint

Unable to resolve path to module '../store/app-api-store'

Check failure on line 8 in apps/settings/src/mixins/AppManagement.js

View workflow job for this annotation

GitHub Actions / NPM lint

"../store/app-api-store" is not found

export default {
setup() {
const appApiStore = useAppApiStore()
return {
appApiStore,
}
},
computed: {
appGroups() {
return this.app.groups.map(group => { return { id: group, name: group } })
Expand Down
10 changes: 5 additions & 5 deletions apps/settings/src/store/app-api-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const useAppApiStore = defineStore('app-api-apps', {
} as IExAppStatus
}
app.active = true
app.canUninstall = false
app.canUnInstall = false
app.removable = true
app.error = ''
}
Expand Down Expand Up @@ -159,7 +159,7 @@ export const useAppApiStore = defineStore('app-api-apps', {
if (app) {
app.active = false
if (app.removable) {
app.canUninstall = true
app.canUnInstall = true
}
}
return true
Expand All @@ -183,14 +183,14 @@ export const useAppApiStore = defineStore('app-api-apps', {
app.active = false
app.needsDownload = true
app.installed = false
app.canUninstall = false
app.canUnInstall = false
app.canInstall = true
app.daemon = null
app.status = {}
if (app.update !== null) {
this.updateCount--
}
app.update = null
app.update = undefined
}
return true
})
Expand All @@ -213,7 +213,7 @@ export const useAppApiStore = defineStore('app-api-apps', {
const app = this.apps.find((app) => app.id === appId)
if (app) {
const version = app.update
app.update = null
app.update = undefined
app.version = version || app.version
app.status = {
type: 'update',
Expand Down
2 changes: 1 addition & 1 deletion apps/settings/src/views/AppStoreSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<!-- Featured/Supported badges -->
<div class="app-sidebar__badges">
<AppLevelBadge :level="app.level" />
<AppDaemonBadge v-if="app?.app_api && app?.daemon" :daemon="app.daemon" />
<AppDaemonBadge v-if="app.app_api && app.daemon" :daemon="app.daemon" />
<AppScore v-if="hasRating" :score="rating" />
</div>
</template>
Expand Down

0 comments on commit 1ef44de

Please sign in to comment.