Skip to content

Commit

Permalink
Fix job scm actions not showing in job list page
Browse files Browse the repository at this point in the history
  • Loading branch information
L2JE committed Feb 1, 2024
1 parent e2d9110 commit 8c971b8
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 229 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ import javax.servlet.http.HttpServletResponse
import java.text.SimpleDateFormat
import java.util.regex.Pattern
import java.util.stream.Collectors
import java.util.Map

@Controller()
class ScheduledExecutionController extends ControllerBase{
Expand Down Expand Up @@ -241,8 +240,6 @@ class ScheduledExecutionController extends ControllerBase{
@GrailsCompileStatic
def actionMenuFragment(){
ScheduledExecution scheduledExecution = authorizingJob.resource
String project = scheduledExecution.project
AuthorizingProject authorizingProject = authorizingProject(project)

def model=[
scheduledExecution : scheduledExecution,
Expand All @@ -251,15 +248,6 @@ class ScheduledExecutionController extends ControllerBase{
isScheduled : scheduledExecutionService.isScheduled(scheduledExecution)
]

if (authorizingProject.isAuthorized(RundeckAccess.Project.APP_SCM_EXPORT)) {
def scmExportOptions = scheduledExecutionService.scmActionMenuOptions(project, authorizingProject.authContext, scheduledExecution) as LinkedHashMap<String, Object>
model << scmExportOptions
}
if (authorizingProject.isAuthorized(RundeckAccess.Project.APP_SCM_IMPORT)) {
def scmImportOptions = scheduledExecutionService.scmActionMenuOptions(project, authorizingProject.authContext, scheduledExecution) as LinkedHashMap<String, Object>
model << scmImportOptions
}

render(template: '/scheduledExecution/jobActionButtonMenuContent', model: model)
}

Expand Down Expand Up @@ -506,7 +494,6 @@ class ScheduledExecutionController extends ControllerBase{
}
}
}

private static String getFname(name){
final Pattern s = Pattern.compile("[\\r\\n \"\\\\]")
def fname=name.replaceAll(s,'_')
Expand Down
1 change: 1 addition & 0 deletions rundeckapp/grails-app/views/menu/jobs.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<%@ page import="org.rundeck.core.auth.AuthConstants;grails.util.Environment" %>
<html>
<head>
<asset:javascript src="static/pages/job/head/scm-action-buttons.js" asset-defer="true" />
<g:set var="rkey" value="${g.rkey()}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="layout" content="base"/>
Expand Down
6 changes: 3 additions & 3 deletions rundeckapp/grails-app/views/scheduledExecution/_showHead.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
</span>

<g:if test="${includeStatusBadge}">
<span class="vue-ui-socket">
<ui-socket section="job-head" location="job-status-badge" socket-data="${enc(attr: [ jobUuid: scheduledExecution.uuid ].encodeAsJSON())}"></ui-socket>
</span>
<span class="vue-ui-socket">
<ui-socket section="job-head" location="job-status-badge" socket-data="${enc(attr: [ jobUuid: scheduledExecution.uuid ].encodeAsJSON())}"></ui-socket>
</span>
</g:if>

<g:if test="${ !scheduledExecution.hasExecutionEnabled()}">
Expand Down
113 changes: 0 additions & 113 deletions rundeckapp/grails-app/views/scm/_jobActionButtonScmActions.gsp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ export default defineComponent({
mounted() {
eventBus.on("job-action", this.confirmAction);
eventBus.on("job-action-single", this.confirmActionSingle);
console.log(":::::::::::::::::::::::::::::::::JOB BULK EDIT CONTROLS MOUNTED")
},
});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ export default defineComponent({
};
await this.jobPageStore.load();
this.loaded = true;
console.log("::::::::::::::::::JOBlISTPAGE MOUNTED!!!")
},
});
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
<template>
<template v-if="scmDataReady">
<li>
<i class="fas fa-spinner fa-pulse"></i>
Loading Scm Actions
</li>
</template>
<template v-if="scmExportEnabled">
<li v-if="scmExportActions" class="divider"></li>
<template v-if="scmExport?.enabled">
<li v-if="scmExport?.actions" class="divider"></li>
<li
v-if="scmExportActions"
v-if="scmExport?.actions"
role="presentation"
class="dropdown-header"
>
<i class="glyphicon glyphicon-circle-arrow-right" />
{{ $t("scm.export.actions.title") }}
</li>
<li v-for="action in scmExportActions">
<li v-for="action in scmExport?.actions">
<a
:href="
jobPageStore.createProjectScmActionHref(action.id, 'export')
Expand All @@ -26,17 +20,17 @@
</a>
</li>
</template>
<template v-if="scmImportEnabled">
<li v-if="scmImportActions" class="divider"></li>
<template v-if="scmImport?.enabled">
<li v-if="scmImport?.actions" class="divider"></li>
<li
v-if="scmImportActions"
v-if="scmImport?.actions"
role="presentation"
class="dropdown-header"
>
<i class="glyphicon glyphicon-circle-arrow-left" />
{{ $t("scm.import.actions.title") }}
</li>
<li v-for="action in scmImportActions">
<li v-for="action in scmImport?.actions">
<a
:href="
jobPageStore.createProjectScmActionHref(action.id, 'import')
Expand Down Expand Up @@ -101,9 +95,7 @@ import {
JobPageStoreInjectionKey,
} from "@/library/stores/JobPageStore";
import { JobBrowseMeta } from "@/library/types/jobs/JobBrowse";
import {defineComponent, inject, PropType, ref} from "vue";
import {JobBrowseItem} from "../../../../library/types/jobs/JobBrowse";
import {ScmMeta} from "../../../../library/interfaces/scm/ScmMeta";
import { defineComponent, inject, ref } from "vue";
interface ScmIntegrationMeta {
enabled: boolean;
Expand All @@ -117,26 +109,15 @@ interface ScmAction {
description: string;
}
const EXPORT_META_KEY = "scmExport"
const IMPORT_META_KEY = "scmImport"
export default defineComponent({
name: "JobListScmActions",
props: {
jobPageStore: {
type: Object as PropType<JobPageStore>
},
scmDataStore: {
type: Object as PropType<ScmMeta>
},
jobUuid: {
type: String
}
},
setup(props) {
const jobPageStore: JobPageStore = inject(
JobPageStoreInjectionKey
) as JobPageStore;
return {
jobPageStore,
toggleModal: ref(false),
scmDataReady: ref(false)
};
},
methods: {
Expand All @@ -149,49 +130,34 @@ export default defineComponent({
getRundeckContext().projectName,
enabled
);
}
},
},
computed: {
enabledStatus(): boolean {
return this.scmExportEnabled || this.scmImportEnabled
return this.scmImport?.enabled || this.scmExport?.enabled;
},
authProjectSCMAdmin(): boolean {
return this.scmDataStore?.authSCMAdmin()
return this.jobPageStore.projAuthz["configure"];
},
scmExportEnabled(): boolean {
return this.scmDataStore?.getEnabledStatus(EXPORT_META_KEY)
return this.scmExport?.enabled;
},
scmExportActions(): ScmAction[] {
return this.scmDataStore?.getActions(EXPORT_META_KEY);
return this.scmExport?.actions;
},
scmImportEnabled(): boolean {
return this.scmDataStore?.getEnabledStatus(IMPORT_META_KEY)
return this.scmExport?.enabled;
},
scmImportActions(): ScmAction[] {
return this.scmDataStore?.getActions(IMPORT_META_KEY);
return this.scmImport?.actions;
},
scmExport(): ScmIntegrationMeta | undefined {
return this.jobPageStore.findMeta(this.getExportMetaKey());
return this.jobPageStore.findMeta("scmExport");
},
scmImport(): ScmIntegrationMeta | undefined {
return this.jobPageStore.findMeta(this.getImportMetaKey());
return this.jobPageStore.findMeta("scmImport");
},
},
async updated() {
this.scmDataReady = true
console.log(":::::::::::::::::::.UPDATED JobListScmActions")
console.log(this.scmImport)
console.log(this.scmExport)
console.log(this.jobUuid)
console.log(this.jobPageStore)
console.log("BELOW THE SCM DATA STORE")
console.log(this.scmDataStore.getActions("scmExport"))
console.log(this.scmDataStore.getCommit("scmExport"))
console.log(this.scmDataStore.getSynchState("scmExport"))
console.log(this.scmDataStore.getEnabledStatus("scmExport"))
console.log("----------------------------------------------")
}
});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ function init() {
);
const jobPageStore = reactive(page);
const jobBrowserStore = reactive(browse)

console.log("::::::::::::::.BEFORE ADDING JobPageMain ITEMS TO STORE")
rootStore.ui.addItems([
{
section: "job-list-page",
Expand Down Expand Up @@ -151,7 +149,6 @@ function init() {
widget: markRaw(JobActionsMenu),
},
]);
console.log("::::::::::::::.AFTER ADDING ITEMS TO STORE")
}

window.addEventListener('DOMContentLoaded', init)

0 comments on commit 8c971b8

Please sign in to comment.