-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first draft of testing done; cut time down in half but its still taki…
…ng too long at around 300 something ms
- Loading branch information
1 parent
ce3d9a8
commit 657ebc5
Showing
6 changed files
with
191 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import {ref} from 'vue'; | ||
import {StatusType} from '@/config.js'; | ||
|
||
|
||
/** | ||
* Builds an actionMenu that can be used for the main header | ||
* @return {Object} {actionChoices, builder} to return the actions to render and the builder to update the choices | ||
*/ | ||
export function useActionMenu() { | ||
const actionChoices = ref([]); | ||
|
||
const builder = { | ||
addWorkflowActions: (latest, operation) => { | ||
if ( latest in StatusType ) { | ||
for ( const [text, nextEvent] of StatusType[latest].transitions) { | ||
builder.addMenuAction(text, StatusType[latest].icon, () => { | ||
operation(nextEvent); | ||
}); | ||
} | ||
} | ||
}, | ||
addMenuAction: (text, icon, operation) => { | ||
actionChoices.value.push({ | ||
icon: icon, | ||
text: text, | ||
operation: operation, | ||
}); | ||
}, | ||
addDivider: () => { | ||
actionChoices.value.push({divider: true}); | ||
}, | ||
clear: () => { | ||
actionChoices.value = []; | ||
}, | ||
}; | ||
|
||
return {actionChoices, builder}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,37 @@ | ||
import {EventType} from './enums'; | ||
|
||
const DEFAULT_TRANSITIONS = [['Approve', EventType.APPROVE], ['Hold', EventType.HOLD], ['Decline', EventType.DECLINE]]; | ||
|
||
export const StatusType = Object.freeze({ | ||
'Preparation': { | ||
icon: 'asterisk', | ||
color: '--rosalution-status-annotation', | ||
actionText: 'Mark Ready', | ||
transitions: [['Mark Ready', EventType.READY]], | ||
}, | ||
'Ready': { | ||
icon: 'clipboard-check', | ||
color: '--rosalution-status-ready', | ||
transitions: [['Mark Active', EventType.OPEN]], | ||
}, | ||
'Active': { | ||
icon: 'book-open', | ||
color: '--rosalution-status-active', | ||
transitions: DEFAULT_TRANSITIONS, | ||
}, | ||
'Approved': { | ||
icon: 'check', | ||
color: '--rosalution-status-approved', | ||
transitions: DEFAULT_TRANSITIONS, | ||
}, | ||
'On-Hold': { | ||
icon: 'pause', | ||
color: '--rosalution-status-on-hold', | ||
transitions: DEFAULT_TRANSITIONS, | ||
}, | ||
'Declined': { | ||
icon: 'x', | ||
color: '--rosalution-status-declined', | ||
transitions: DEFAULT_TRANSITIONS, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.